1

Long story short, I have been working with a Digital Ocean droplet to learn a bit more about managing my own server. Somewhere along the line, I managed to set the ownership of some directories to another user (serverpilot), and my root user can no longer see or access them.

I have two users on the server, one (root) with sudo privileges and the other is a basic user (serverpilot).

When I ssh into the server with root, I am unable to see a bunch of directories. When I do so via the serverpilot use, I can see them all. Doing ls -l shows the owner as 'serverpilot'.

Since 'serverpilot' doesn't have sudo privileges, how can I reset the owner back to 'root', so both 'root' and 'serverpilot' can access the directories? Do I have to boot the server in recovery?

I'm running Ubuntu Server 16.04 if that makes a difference.

Edit: As per the comments of @davidfoster below, the output of getfacl . wp-content is as follows:

# file: .
# owner: serverpilot
# group: serverpilot
user::rwx
user:www-data:r-x
group::r-x
group:serverpilot:rwx       #effective:r-x
mask::r-x
other::r-x
default:user::rwx
default:user:www-data:r-x
default:group::r-x
default:group:serverpilot:rwx
default:mask::rwx
default:other::r-x

# file: wp-content
# owner: serverpilot
# group: serverpilot
user::rwx
user:www-data:r-x
group::r-x
group:serverpilot:rwx       #effective:r-x
mask::r-x
other::r-x
default:user::rwx
default:user:www-data:r-x
default:group::r-x
default:group:serverpilot:rwx
default:mask::rwx
default:other::r-x

And the parent directory (public):

# file: .
# owner: serverpilot
# group: serverpilot
user::rwx
user:www-data:r-x
group::r-x
group:serverpilot:rwx       #effective:r-x
mask::r-x
other::r-x
default:user::rwx
default:user:www-data:r-x
default:group::r-x
default:group:serverpilot:rwx
default:mask::rwx
default:other::r-x

# file: public
# owner: serverpilot
# group: serverpilot
user::rwx
user:www-data:r-x
group::r-x
group:serverpilot:rwx       #effective:r-x
mask::r-x
other::r-x
default:user::rwx
default:user:www-data:r-x
default:group::r-x
default:group:serverpilot:rwx
default:mask::rwx
default:other::r-x
EHerman
  • 111
  • 3
  • [This](http://askubuntu.com/questions/99767/can-a-folder-have-2-or-more-owners) could help. Let me know if you're issue is something other than what I linked. – TheOdd Nov 08 '16 at 15:02
  • Try with: $> chmod -R 777 directory – kyodake Nov 08 '16 at 15:04
  • What are the access permissions on those directories? You can see them with `ls -ld `. A user (including `root`) doesn't need to own a file or directory to see its content with the right permissions. – David Foerster Nov 08 '16 at 15:34
  • @DavidFoerster Under the 'root' account it says that the file/directory doesn't exist (I'm unable to see the directory the command line via `ls`). Under the 'user' user, the directories are listed and the output is `drwxr-xr-x+ 10 user user 4096 Nov 8 19:06 wp-content`. – EHerman Nov 08 '16 at 19:30
  • So you're using access control lists in addition to POSIX access control. What's the output of `getfacl . wp-content` (i. e. `wp-content` and its parent directory)? – David Foerster Nov 08 '16 at 20:52
  • @DavidFoerster I went ahead updated the initial question and added the output. To be clear, the original account 'user' should have been 'serverpilot', so I have updated that above as well. – EHerman Nov 08 '16 at 22:14
  • I have no idea why `root` would have no read access on any of those directories. Can you verify that all parent directories are readable and traversable by "other"? Maybe `sudo` is configured to use a different user. What's the output of `sudo id`? – David Foerster Nov 09 '16 at 00:23
  • How did the story end? What was the solution? – Avatar Jun 03 '23 at 15:20

0 Answers0