Look in:

Web oracle-core-dba.blogspot.com

Wednesday, December 12, 2007

Simple FTP setup in Linux

By default FTP comes disabled on stock RedHat/Oracle Enterprise/Centos server installs. In some occasions I find the need to enable FTP.

Below I will show you how to do it:
Become the root user on your server.
Change to the /etc/xinetd.d directory

cd /etc/xinetd.d/

Edit the gssftp file

vi gssftp

Change the line that says disable = yes to disable = no. Also remove the –a option in the server_args line.

Your config file should now look like the one below. Save the file and exit vi.

service ftp
{
flags = REUSE
socket_type = stream
wait = no
user = root
server = /usr/kerberos/sbin/ftpd
server_args = -l
log_on_failure += USERID
disable = no
}

The -a option removes the following restriction, as described in the man ftpd page.
-a
Connections are only allowed for users who can authenticate (via the ftp AUTH mechanism) and who are authorized to connect to the named account without a password. (Anonymous ftp may also be allowed if it is configured.)

Restart the xinetd daemon.
/etc/init.d/xinetd restart

You should now be able to FTP to your server.

That’s it, you’re FTP service is now enabled. Now let me explain when I actually use
FTP. Sometimes I will transfer very large files or amounts of data between my servers (many gigabytes worth). I will enable FTP temporarily to do this since FTP can do these transfers a little more quickly than SFTP because it doesn’t have as
much overhead. After I’m done with the transfer, I then disable FTP.

EXAMPLES

ftp rmsi.oracle.com
This command will attempt to connect to the ftp server at rmsi.oracle.com. If it succeeds, it will ask you to log in using a username and password. Public ftp servers often allow you to log in using the username "anonymous" and your email address as password. Once you are logged in you can get a list of the available ftp commands using the help function:

ftp> help
This lists the commands that you can use to show the directory contents, transfer files, and delete files.

ftp> ls
This command prints the names of the files and subdirectories in the current directory on the remote computer.

ftp> cd customers
This command changes the current directory to the subdirecotry "customers", if it exists.

ftp> cd ..
Changes the current directory to the parent direcotry.

ftp> lcd images
Changes the current directory on the local computer to "images", if it exists.

ftp> ascii
Changes to "ascii" mode for transferring text files.

ftp> binary
Changes to "binary" mode for transferring all files that are not text files.

ftp> get image1.jpg
Downloads the file image1.jpg from the remote computer to the local computer. Warning: If there already is file with the same name it will be overwritten.

ftp> put image2.jpg
Uploads the file image2.jpg from the local computer to the remote computer. Warning: If there already is file with the same name it will be overwritten.

ftp> !ls
A '!' in front will execute the specified command on the local computer. So '!ls' lists the file names and directory names of the current directory on the local computer.

ftp> mget *.jpg
With mget you can download multiple images. This command downloads all files that end with ".jgp".

ftp> mput *.jpg
Uploads all files that end with ".jgp".

ftp> mdelete *.jpg
Deletes all files that end with ".jgp".

ftp> prompt
Turns iteractive mode on or off so that commands on multiple files are executed without user confirmation.

ftp> quit
Exits the ftp program.

No comments: