WHAT’S SFTP IN LINUX AND HOW TO CONFIGURE SFTP SERVER IN LINUX

sftp server in linux

SFTP stands for secure file transfer protocol . SFTP is a combination of both ssh( security) and ftp ( fast transfer process). Simple ftp( file transfer protocol ) server is best for file transfer and ssh (secure shell) server is best known for authentication . SFTP was made to make file transfer faster but connection should be encrypted .SFTP server usually runs over TCP port 22.

HOW TO CONFIGURE SFTP SERVER IN LINUX ?

FOLLOW THESE STEPS:

  • First install ssh server package .
  • In my system ssh package is already installed .
[root@localhost ~]# yum install openssh* -y
Loaded plugins: rhnplugin, security
Repository 'a' is missing name in configuration, using id
This system is not registered with RHN.
RHN support will be disabled.
Setting up Install Process
Package openssh-server-4.3p2-36.el5.i386 already installed and latest version
Package openssh-4.3p2-36.el5.i386 already installed and latest version
Package openssh-clients-4.3p2-36.el5.i386 already installed and latest version
Package openssh-askpass-4.3p2-36.el5.i386 already installed and latest version
Nothing to do
  • Now install package of ftp server .
[root@localhost ~]# yum install vsftpd*
Loaded plugins: rhnplugin, security
Repository 'a' is missing name in configuration, using id
This system is not registered with RHN.
RHN support will be disabled.
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package vsftpd.i386 0:2.0.5-16.el5 set to be updated
--> Finished Dependency Resolution
Dependencies Resolved
==============================================================================================================
 Package                   Arch                    Version                         Repository            Size
==============================================================================================================
Installing:
 vsftpd                    i386                    2.0.5-16.el5                    a                    140 k
Transaction Summary
==============================================================================================================
Install      1 Package(s)
Update       0 Package(s)
Remove       0 Package(s)
Total download size: 140 k
Is this ok [y/N]: y

It will calculate file size and ask you whether you wanna install it or not . Type y and hit ENTER . Your package will be installed in a few seconds .

Downloading Packages:
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing     : vsftpd                                                                                 1/1
Installed:
  vsftpd.i386 0:2.0.5-16.el5
Complete!
  • Disable linux firewall and se linux settings
  • To disable firewall settings     =    iptables  -F
  • To disable  selinux settings     =    setenforce 0

[root@localhost ~]# iptables -F
[root@localhost ~]# setenforce 0
  • Start the  ftp server service
[root@localhost ~]# service vsftpd restart
Shutting down vsftpd:                                      [FAILED]
Starting vsftpd for vsftpd:                                [  OK  ]
  • Also start the ssh server service
[root@localhost ~]# service sshd restart
Stopping sshd:                                             [  OK  ]
Starting sshd:                                             [  OK  ]Check the ip address of server machine by  below command
  1. ip    a
  2. ifconfig

Check ip address of server machine by using any one command

ip address in linux

NOW COMES THE CLIENT ROLE

  • To connect through sftp server
  • Type  sftp  ipaddress of server machine
  • Then it will ask give root password to connect .
  • Once you give right password .
[root@localhost ~]# sftp 192.168.0.130
Connecting to 192.168.0.130...
The authenticity of host '192.168.0.130 (192.168.0.130)' can't be established.
RSA key fingerprint is ea:46:73:83:4a:60:77:34:20:26:ab:a7:21:96:f7:f7.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '192.168.0.130' (RSA) to the list of known hosts.
root@192.168.0.130's password:
  • When you see ” sftp> ” means you are connected to server machine through sftp server .
  • Type dir (to check directories )
sftp> dir
3usageeks                  Deepit                     Desktop                    anaconda-ks.cfg
install.log                install.log.syslog         rhel54iso.iso              webmin-1.580-1.noarch.rpm
  • To know which commands to run in sftp server  Type   ?
  • Mainly  get ( to download ) and put( to upload ) are used .

sftp> ?
Available commands:
cd path                       Change remote directory to 'path'
lcd path                      Change local directory to 'path'
chgrp grp path                Change group of file 'path' to 'grp'
chmod mode path               Change permissions of file 'path' to 'mode'
chown own path                Change owner of file 'path' to 'own'
help                          Display this help text
get remote-path [local-path]  Download file
lls [ls-options [path]]       Display local directory listing
ln oldpath newpath            Symlink remote file
lmkdir path                   Create local directory
lpwd                          Print local working directory
ls [path]                     Display remote directory listing
lumask umask                  Set local umask to 'umask'
mkdir path                    Create remote directory
progress                      Toggle display of progress meter
put local-path [remote-path]  Upload file
pwd                           Display remote working directory
exit                          Quit sftp
quit                          Quit sftp
rename oldpath newpath        Rename remote file
rmdir path                    Remove remote directory
rm path                       Delete remote file
symlink oldpath newpath       Symlink remote file
version                       Show SFTP version
!command                      Execute 'command' in local shell
!                             Escape to local shell
?                             Synonym for help
  • To logout type = bye  or exit command
sftp> bye
  • Now to login with any other user .
  • Type =sftp    user@ipaddress of server machine
  • Here  deepit is my user  and 192.168.0.130 is my ip ( server)
  • Then It will ask you user password . Type password correctly and you are logged in .
[root@localhost ~]# sftp deepit@192.168.0.130
Connecting to 192.168.0.130...
deepit@192.168.0.130's password:
  • To stop sftp type below command in server machine

 

[root@localhost ~]# service vsftpd stop
[root@localhost ~]# service sshd stop
 

 

KDE – HOW TO INSTALL KDE DESKTOP IN LINUX & GET START BUTTON (WINDOWS ) IN LINUX .

WHATS WEBMIN AND HOW TO CONFIGURE WEBMIN IN LINUX AS SERVER AND WINDOWS AS CLIENT

SSH SERVER – HOW TO CONFIGURE SSH SERVER ON LINUX AS SERVER AND WINDOWS,LINUX,ANDROID OR IOS AS CLIENT .

 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s