Setting a static IP address in CentOS Submitted by admin, on January 23rd, 2012 During a default install of CentOS it will try to either automatically obtain an IP address using DHCP, or it wont even set up the network interface automatically.
I have put together a how-to showing how to setup a SFTP server on CentOS with full CHROOT.
Video: https://www.youtube.com/watch?v=d4D6xqQigH8
# systemctl enable sshd.service
# systemctl start sshd.service
# vi /etc/ssh/sshd_config
Comment the following line (add a hash before it)
Subsystem sftp /usr/local/libexec/sftp-server
and add the following just below it, I recommend using tab instead of spaces
Subsystem sftp internal-sftp
Now scroll to the end of the config file and add the following to create the match rule:
Match Group sftponly
ChrootDirectory %h
ForceCommand internal-sftp
X11Forwarding no
AllowTcpForwarding no
Save the config file and close it. (Press ESC and type 'wq!')
# systemctl restart sshd.service
# groupadd sftponly
# useradd john -g sftponly -s /bin/false
# passwd john
# mkdir /home/john/datadir
# chown root /home/john
# chmod 755 /home/john
# chown john /home/john/datadir
# chmod 755 /home/john/datadir
# setsebool -P ssh_chroot_rw_homedirs on
Couple of things. My minimal install of CentOS 7 did not have net-tools installed for some reason ? :
yum install net-tools
^needed for netstat command
and i also install nano as text editor of choice as well as making sure CentOS 7 is updated before i start :
yum install nano
yum update
Other than that i think its a great how-to and video - great work.
(p.s. you should put the video link in your introduction)
Mr. Gordon
I followed the above instructions and watched your video. Both very helpful! I am getting a Permission denied (publickey,gssapi-keyex,gssapi-with-mic). Couldn't read packet: Connection reset by peer error. I am confused as to why is denying the connection, I followed your steps and you were able to connect with your test user, but for some reason I am not. Have you seen this before? Any help would be greatly appreciated.
For more info, look here, it has all the steps above and more
https://en.wikibooks.org/wiki/OpenSSH/Cookbook/File_Transfer_with_SFTP