sftp : Secure Copy Of File From One Server To Another Server
File Transfer Protocol (FTP) was widely used protocol to transfer files or data remotely in unencrypted format which is not secure way to communicate , because all transmissions happens in clear text and the data can be readable by anyone during sniffing the packets on the network.
SFTP (Secure File Transfer Protocol) runs over SSH protocol (using port 22 for secure connection).
WINSCP also uses SFTP in background.
1.Connect to a remote server for sFTP
By default SSH protocol is used to authenticate and establish a SFTP connection. To start an SFTP session, enter the username and remote hostname or IP address at the command prompt. Once authentication successful, you will see a shell with an sftp> prompt.
[root@localserver ~]# sftp ajay@192.168.1.11 or sftp ajay@remoteserver
Connecting to 192.168.1.11...
ajay@192.168.1.11's password:
sftp>
2. Commands of sFTP (help)
At sftp shell prompt, type "?" or "help" to get list of all commands
sftp will give you local and remote version of each command. Usually, all local commands are prefixed by an "l".
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
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
3. Command Examples :-
sftp> lpwd
Local working directory: /
sftp> pwd
Remote working directory: /ajay/
On Remote
sftp> ls
On Local
sftp> lls
sftp> put xyz (uploading file on remote server from local server)
Uploading xyz to /ajay/xyz
sftp> get abc (fetching file from remote server to local server)
Fetching /ajay/abc to abc
sftp> mkdir www (making dir on remote server)
sftp> lmkdir hhh (making dir on local server)
On Remote
sftp> cd www (change dir to remote)
sftp>
On Local (change dir to local)
sftp> lcd hhh
sftp> rm abc (remove file from remote)
sftp> rmdir www (remove dir from remote)
That`s it , we are done with basic sFTP operations
Cheers !!
AJ
SFTP (Secure File Transfer Protocol) runs over SSH protocol (using port 22 for secure connection).
WINSCP also uses SFTP in background.
1.Connect to a remote server for sFTP
By default SSH protocol is used to authenticate and establish a SFTP connection. To start an SFTP session, enter the username and remote hostname or IP address at the command prompt. Once authentication successful, you will see a shell with an sftp> prompt.
[root@localserver ~]# sftp ajay@192.168.1.11 or sftp ajay@remoteserver
Connecting to 192.168.1.11...
ajay@192.168.1.11's password:
sftp>
2. Commands of sFTP (help)
At sftp shell prompt, type "?" or "help" to get list of all commands
sftp will give you local and remote version of each command. Usually, all local commands are prefixed by an "l".
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
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
3. Command Examples :-
sftp> lpwd
Local working directory: /
sftp> pwd
Remote working directory: /ajay/
On Remote
sftp> ls
On Local
sftp> lls
sftp> put xyz (uploading file on remote server from local server)
Uploading xyz to /ajay/xyz
sftp> get abc (fetching file from remote server to local server)
Fetching /ajay/abc to abc
sftp> mkdir www (making dir on remote server)
sftp> lmkdir hhh (making dir on local server)
On Remote
sftp> cd www (change dir to remote)
sftp>
On Local (change dir to local)
sftp> lcd hhh
sftp> rm abc (remove file from remote)
sftp> rmdir www (remove dir from remote)
That`s it , we are done with basic sFTP operations
Cheers !!
AJ
This is my first time visit to your blog and I am very interested in the articles that you serve. Provide enough knowledge for me. Thank you for sharing useful and don't forget, keep sharing useful info: File share
ReplyDeletei never know the use of adobe shadow until i saw this post. thank you for this! this is very helpful. File share website
ReplyDelete