0

I deployed on a Digital Ocean's Ubuntu server a web app, but its been run in /root/appfolder.

I have tried chmod 744 /root and also 744 permission on the specific folder inside of root, but i can't access it with my user. I want to make it possible that other developers ssh into the server and have access to the folder.

Maybe I have to create a link to that folder so that every user has it in their home directoy? Up to this point I have no clue on what the most secure or best practice should be, not to say that still I get access denied to that folder using another user even after giving it read privelage.

Solution

chmod 744 /root gives you permission to read, not to open it (execute it). I just had to redefine permissions and chmod -R o+x /root and its done.

3
  • 2
    Your filesystem has clearly-defined places to put applications that can be run by anybody. /root is not one of those places. Why did you choose /root? Why not simply use a correct place?
    – user535733
    Commented May 17, 2021 at 16:06
  • @user535733 However, why other users can't access /root if appropriate permission has been set up is still a completely valid question.
    – raj
    Commented May 17, 2021 at 18:49
  • 1
    I understand /root is for the root user. I get it. But why can't other users view the folder if i set the permissions correctly? Commented May 17, 2021 at 19:54

5 Answers 5

1

The permissions 744 (r-xr--r--) are wrong. It should be 755 (rwxr-xr-x).

with 744, others can see what is in the directory, but without x on the directory, they can't access anything in it.

1
  • Yes. You are correct. Read the complete solution. I figured that out after a few attempts. I thought read implied opening foders. Commented May 19, 2021 at 0:07
0

See the Filesystem Hierarcy Standard at https://refspecs.linuxfoundation.org/fhs.shtml.

It explains where things go.

3
  • I found the solution. I was doing something wrong. Commented May 17, 2021 at 20:56
  • @GabrielMartinez If you know a solution to your problem, then please write it here as an answer, so if anybody has the same problem, he/she will know how to solve it.
    – raj
    Commented May 17, 2021 at 21:49
  • @raj sorry. I thought posting the solution on top as edit was the way to go. I am new to this. My bad Commented May 26, 2021 at 10:17
0

The only users that should have access to /root are root itself or users with sudo access. Changing chmod values is not very good practice. Especially not in or on the root folder. If you want users other than yourself to have access, you can set a user up for sudo access.

To add a user to the sudo group run the command below as root or as another sudo user. Be sure to change “username” with the name of the user that you want to grant permissions to.

$ usermod -aG sudo username

Simply adding the user to the sudo group will require them to use their password every time they use the sudo command. To disable the need for a password, edit the sudoer's file by running:

$ sudo visudo

At the bottom of the file that opens, add this line for every user you want to give passwordless sudo permissions to (be sure to change "username"):

username  ALL=(ALL) NOPASSWD:ALL

Optionally, instead of using individual usernames, you can assign an entire group of users by substituting username with groupname.

2
  • I will be doing this. Thanks a lot Commented May 19, 2021 at 0:08
  • One other note. ALWAYS use visudo to edit that file (/etc/sudoers). Using vim or nano or any other editor will not parse it for syntax errors. If you end up saving that file with a syntax error, your life will be not worth living. (lol)
    – DataMinion
    Commented May 24, 2021 at 14:27
0

chmod 744 /root gives you permission to read, not to open it (execute it). I just had to redefine permissions and chmod -R o+x /root and its done.

0

The other groups of users can have the permission of your /root folder from command line. But if you changed other user's permissions from Menu > Users & Groups > User 1 > Permissions Tab, and remove the root permission, the selected user won't be able to access it. You are now secured.

1
  • Thank you for your response. I will be looking into that. Commented May 19, 2021 at 0:06

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .