Showing posts with label ftp. Show all posts
Showing posts with label ftp. Show all posts

Tuesday, 11 July 2017

How to install and configure the ftp server in linux system

When you are going through this post, you can learn how to install or configured the file transfer protocol in linux operating system.

Normally, FTP server is used to upload or download the files from server machine to client machine. FTP works on TCP 20/21 protocol, TCP port 20 is used for uploading and TCP 21 port is used for downloading purpose.

Step by step method of FTP server installation and configuration:
 
➦ In the initial step , we will install the all required rpm or packages on the Linux server using "YUM" utility.[root@localhost]# yum  install  vsftpd*

If you have source rpm packages then you can install it. In our case we will install the rpm with yum. Using above command all the ftp packages and their dependency are installed.
 
Once the required packages has been installed successfully on the Linux server, we will start the ftp services on the server.[root@localhost]#service  vsftpd  start

Once the service start successfully we will make permanent it so after reboot of server it would be enable always.
[root@localhost]#chkconfig vsftpd on
 
Now, to check the location of ftp server file which we upload or create after ftp server installation.[root@localhost]#cd /var/ftp/pub[root@localhost]#ls

And check the file which you have created after ftp server installation. If you find your created file here then you can ensure your ftp server has been installed successfully on Linux server.
 
Now for checking the ftp server using login in it.

# ftp  Server IP address  ( In my case server ip is 192.168.1.240)
Name(192.168.1.240:root):anonymous
Passwd   (press enter)   --- by defult anonymous password is blank

ftp>   (It will show you have successfully enter in ftp server)
ftp> ls
pub ( will see this directory in ftp location)
ftp>cd  pub
pub> mkdir  testing
pub> permission denied  (error getting)
 
To give the permission to make a directory in pub ,changes in this file[root@localhost]#vi  /etc/vsftpd/vsftpd.conf

Uncomment all these below lines
anonymous_enable=yes
anon_upload_enable=yes
anon_mkdir_write_enable=yes
save the file
 
Now we will take a restart of the ftp services again. You can follow the step 2 to take a restart of ftp services.
 
In this step we will provide the permission to pub folder so that client user can read/write the file and folder in the default direcoty.[root@localhost]#chmod 777  /var/ftp/pub

In my case I will give the full permission to pub folder. You can set the permission according to your project requirement.
 
If you want to ensure that you are able to created and access the folder or not on ftp server then in this case you need to login again in ftp server.[root@localhost]#ftp  192.168.1.240
Name: anonymous
Passwd (enter)
ftp> Cd  pub
pub>mkdir testing
testing           (directory created)
pub>ls
testing

If you want to check the directory which we created in above text please go to the below location and find it
[root@localhost]#cd  /var/ftp/pub
Pub]#ls
testing

So now you will get the file on the ftp pub folder which you created that means the permission which you provide to the user are working properly.
 
You want only one user is able to login by ftp server and access only one particular folder, also not able to delete the file and folder on ftp server, having a ability of uploading and downloading through ftp server. For this thing we have to change in configuration file and chroot_list, ftpuser file.

First create a user which you want to access for ftp user
[root@localhost]# useradd  -s /sbin/nologin  ttftpuser       (His shell is nologin so other user not login)[root@localhost]#passwd  ttftpuser

Now create a folder in ttftpuser which you want to give access
[root@localhost]#cd  /home/ttftpuser
ttftpuser~]#mkdir  noidaftp
ttftpuser~]#chmod  777  noidaftp

Now go to the file chroot_list, add the user  only which you want to give access.
[root@localhost]#vi  /etc/vsftpd/chroot_list
ttftpuser    (make a entry of user which you want to give access)

Now if you want no other user login in ftp server then entry all those user except chroot_list user in ftpuser file.
[root@localhost]#vi /etc/vsftpd/ftpuser

Promartuser    (these are users on which ftp server is make )
testing

Now go to configuration file and make changes in  file and change all the parameter which is required on the configuration files.
[root@localhost]#vi /etc/vsftpd/vsftpd.conf

anonymous_enable=NO
local_enable=YES
write_enable=YES
local_umask=022
dirmessage_enable=YES
xferlog_enable=YES
connect_from_port_20=YES
syslog_enable=NO
dual_log_enable=YES
vsftpd_log_file=/var/log/vsftpd.log
xferlog_file=/var/log/xferlog
xferlog_std_format=YES
ftpd_banner=*************************Welcome to blah FTP service******************
chroot_list_enable=YES
chroot_list_file=/etc/vsftpd/chroot_list
listen=YES
pam_service_name=vsftpd
userlist_enable=YES
tcp_wrappers=YES
listen_port=54321
cmds_allowed=ABOR,ACCT,ALLO,APPE,CDUP,CWD,EPRT,EPSV,FEAT,HELP,LIST,MDTM,MKD,MODE,NLST,NOOP,OPTS,PASS,PASV,PORT,PWD,QUIT,REIN,REST,RETR,RMD,RNFR,RNTO,SITE,SIZE,SMNT,STAT,STOR,STOU,STRU,SYST,TYPE,USER,XCUP,XCWD,XMKD

Save the file for above changes which is in bold text in file and restart the ftp services which is describe in step 2.
[root@localhost]#service vsftpd restart

Now check login on console mode
[root@localhost]#ftp  192.168.1.243 54321

Enter username:ttftpuser
Passwd..enter the passwd
ftp> you have successfully enter
ftp>ls
noidaftp      (folder you have seen)
ftp>put  vsftpd.conf        (it will upload file )
ftp>get  vsftpd.org          (it will download file)

If you want to change the user shell please run the below command method as describe below.
[root@localhost]#usermod  -s  /sbin/nologin  username[root@localhost]#usermod  -s /bin/bash  username

So using above method we can easily installed and configured the ftp server on Linux operating system.

Monday, 29 May 2017

Important Linux TCP/IP Port Number

Please find the below complete list of TCP/IP port number in Linux system.

➤ 20- FTP ( File Transfer Protocol) -It is used for transfer the data using ftp connection

➤ 21- FTP Control - It is used this port for ftp connection.

➤ 22- SSH (Secure Shell)- It is used for connecting the secure shell which using SSL encryption.

➤ 23- TELNET - It is used for insecure remote connection.

➤ 25- SMTP (Simple Mail Transfer Protocol)- It is used as a mail transfer agent for email server.

➤ 53- DNS (Domain name system)- It is used for translate the domain name to IP address.

➤ 67- BOOTP (Bootstrap Protocol)- Used for automatically assign the IP address to network device.

➤ 68- DHCP (Dynamic host configuration protocol)- It is a network protocol to enable a server to automatically assign an IP address to system.

➤ 69- TFTP (Trivial file transfer protocol)- Used this protocol in PXE Boot services.

➤ 80- HTTP ( Hypertext Transfer protocol)- Used for WWW web connection.

➤ 88- Kerberos Protocol

➤ 110- POP3 (Post Office Protocol)- Used as a mail delivery agent.

➤ 113- XINETD (Extended Internet Daemon)

➤ 115- SFTP ( Secure File Transfer Protocol)

➤ 123- NTP (Network time protocol)- Used for time syncing uses UDP protocol

➤ 137- NetBIOS (Network basic Input/Output system)

➤ 139- NETBIOS-SESSION Service

➤ 143- IMAP (Internet Message Access Protocol)

➤ 161- SNMP (Simple Network Management Protocol)- Used for network monitoring.

➤ 389- LDAP (Lightweight Directory Access Protocol)

➤ 443- HTTPS ( Hypertext Transfer protocol secure)- Used with SSL encryption.

➤ 445- SMB (Server Message Block or SAMBA)

➤ 514- Syslogd (udp port)

➤ 840- NIS (Network Information Service)

➤ 873- rsync Used for file synchronization.

➤ 990- FTPS (File transfer protocol secure)

➤ 993- IMAPS ( For Secure Connection)

➤ 995- POP3s ( Mail delivery agent with secure connection)

➤ 2049- NFS ( Network file sharing)