Master of Reality wrote:can people detect whether sftp is running or not from the internet? (consider ssh as running on the internet side)... such as by it running on a different port than normal sshd
sftp is the ssh client. sshd is the server and listens on port 22 as it would any other time. The only thing different that happens on the server side when you connect to sshd with sftp is it spawns the sftp-server program instead of a login shell. The sftp-server program exits when you end your sftp session just like your shell exits when you end your interactive ssh session. Everything is done using the SSH protocol (and ports). So the only way a remote person can tell if you have sftp-server enabled in your sshd_config is by trying to connect to it with the sftp client. If you don't have it enabled they'll get a message something like:
- Code: Select all
[voidmain@voidhost voidmain]$ sftp voidlinux
Connecting to voidlinux...
Request for subsystem 'sftp' failed on channel 0
Couldn't read packet: Connection reset by peer
whereas if you do have it enabled they'll get either a login prompt or be logged in automatically if you are using key based, host based, or any other type of ssh authentication:
- Code: Select all
[voidmain@voidhost voidmain]$ sftp voidlinux
Connecting to voidlinux...
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
sftp>
Really, it's as simple as it gets. Edit your /etc/ssh/sshd_config file and make sure this line is uncommented at the end of the config file:
- Code: Select all
Subsystem sftp /usr/libexec/openssh/sftp-server
Restart sshd and then you can ssh, scp, *and* sftp to your server.
NOTE: The path to sftp-server might be different on your system. The above path is accurate for a Red Hat or Fedora system.