Linux server with the following software:
- Ubuntu 10.04 LTS x64 - Linux kernel 2.6.38
Need the following configuration/software:
- SSH through rsa key authentication - SFTP with the following properties: - Single user - Access to ONLY /var/www (no home directory what so ever) - Rsa key authentication
The server is going to be on the internet, so it needs to be secure. How can I properly do this? I get stuck with the configuration of the SFTP user, he can access FTP but not write anything, also not download. I guess I do something wrong with chown or permissions are not set properly, I just can't figure out what is causing this problem.
sudo apt-get install openssh-server sudo mkdir /var/www sudo groupadd sftp_users sudo useradd -d "/var/www" --groups sftp_users -s /bin/false -p '!' "root_sftp" sudo passwd root_sftp sudo chmod 751 /var/ sudo chmod 770 /var/www sudo chown root:root_sftp /var/www sudo nano /etc/ssh/sshd_config
Added/changed the following things to the sshd_configuration file
PermitRootLogin no AuthorizedKeysFile /etc/ssh/authorized_keys PermitEmptyPasswords no PasswordAuthentication yes Subsystem sftp internal-sftp Match User root_sftp ChrootDirectory /var/www ForceCommand internal-sftp X11Forwarding no AllowTcpForwarding no PermitRootLogin no AllowAgentForwarding no
Now once again, the problem is, the user can login, with a key, the SSH is also working perfect but the SFTP is not working properly.
The user can login with SFTP (I used filezilla) but then he can't upload etc. It seems that the user only has the execute bit (--x or 1)
I really hope someone can help me, it took me a long time to configure already. Thanks for help and your time.
Extracted permission of root, /var and /var/www
# ls -lad / /var /var/www drwxr-xr-x 22 root root 4096 2012-03-13 22:59 / drwxr-x--x 15 root root 4096 2012-03-13 23:04 /var drwxrwx--- 3 root root_sftp 4096 2012-03-13 23:15 /var/www
The /var/www directory is empty.