I built an Ubuntu droplet and logged into the console as root and placed my files in a directory called jackssite. The path to the directory is /root/jackssite How do I give permissions to a user to ssh into the directory and look at the files and change what they may need to change?
I have users set up but if they use my root ssh login and password they get permission denied. Also, none of this is going to be a production site. I’m just trying out some things and sharing it with another user to help me get it right. What can I do to get them permission?
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!
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
Enter your email to get $200 in credit for your first 60 days with DigitalOcean.
New accounts only. By submitting your email you agree to our Privacy Policy.
Heya,
To allow a user to SSH into a directory and make changes, you’ll need to adjust the directory permissions and ownership. I’ll assume that you have a user called
jackssite
who needs access to the/root/jackssite
directory.Change the directory location: As a general rule, you shouldn’t give other users access to the
/root
directory because it’s the home directory for the root user and contains system-level configurations. It’s safer to move thejackssite
directory to a non-root location, such as/home/jackssite
. To do this, use themv
command:Change directory ownership: The next step is to change the ownership of the
jackssite
directory to the userjackssite
. You can use thechown
command for this:Set directory permissions: After changing the ownership, you also need to set the directory permissions so that
jackssite
has read, write, and execute permissions. You can use thechmod
command for this:This command will give
jackssite
(the owner) read, write, and execute permissions, and other users will have read and execute permissions.Set up SSH access for jackssite: If
jackssite
doesn’t have SSH access yet, you need to set that up. You’ll create a.ssh
directory in their home directory, then create anauthorized_keys
file where you’ll paste their public SSH key:In the
authorized_keys
file, pastejackssite
’s public key,. Then set the permissions for this file:Now, the
jackssite
should be able to SSH into your server with their SSH key, and they’ll have access to thejackssite
directory. They can navigate to it usingcd /home/jackssite
and then make the necessary changes.