I am relatively new to unix server admin, so this question may seem dumb. I am running a CentOS 7 droplet. I have created a new user and set the users home directory to /var/www/blablabla/public_html via usermod. I guess I really have two questions:
How do I restrict the user to only be able to do anything within that folder? (ie: that folder is the user’s root and they cannot view/edit anything higher in the directory tree)
Can I restrict a user from connecting via SSH while still allowing them to connect via SCP? And if so, how?
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
If you do not want to use user home directory eg. /home/exampleuser then ssh cofiguration should be like this Subsystem sftp internal-sftp Match group sftpusers
ForceCommand internal-sftp
Restart ssh service then it will work for you.
Hello guys,
In the article shows that when typing the command ls -al would show something like this:
root:root /home/ root:root /home/exampleuser/ root:root /home/exampleuser/htdocs/
exampleuser:sftpusers /home/exampleuser/htdocs/public_html
But typing the command shows me this result: https://screenshot.net/pt/1yxyxhx
using the cd command and then the ls -al command: https://screenshot.net/pt/rlnlnf6
As for permission, I used the command:
chown -R exampleuser examplegroup /var/www/my-site.com/wp-content
but the /wp-content folder is already existing and already has the permission www-data:www-data. So I can change it to exampleuser:sftpusers, no problem?
Anyway, I am not able to access SFTP with this new user when placed in the group, ie I have an existing user and he accesses normally, but accesses all folders of the server. Then I create the group, put the user in the group with the command below, and do the rest of the steps shown in the article, but after that the user no longer enters:
usermod -g newgroup -d /var/www/my-site.com/wp-content -s /sbin/nologin existinguser
Can someone help me?
Thanks.
how can i restrict user to his home directory only, who is logging through key in filezilla? Please let me know the way
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.