0

I am doing an online course and the current exercise sees me learning more about sudo. I had to log in as another user and run a command to acccess a password. In my sudo exercise I have finally got myself logged in as the pseudo user with the discovered password from the first part of the question. Now I have to access a token in the file /root/token.txt. Whilst logged in as the user pseudo I can see from sudo -l the following:

user pseudo may run the following commands on sudo
            (ALL) NOPASSWD:  ALL

if I cd to the / directory and run ls -la I get

drwx------   2  root root 4096 Jun 18 1521 root

From the above I deduce only the owner has rwx permissions and that the owner is root. What I am struggling with is how do I access the token file when it would appear to me that I need root access, HELP please?

2
  • Do you know how to use sudo to execute commands that normally can be used by root only? – Jos Aug 28 '18 at 11:00
  • Hi Jos, yes I am familiar with sudo to execute commands normally only permissible by root. What i was confused by was how the command should be to open the file directly. – user278930 Aug 29 '18 at 13:58
1

Since user pseudo may run ALL commands, you should be able to access the file regardless of the directory's owner given that you are already logged in as pseudo e.g.

sudo cat /root/token.txt
0
0

Consider sudo as a bash command with options: -u for user, -g for group, where the "default" group is 0, and uid=root. You can now make a special group, "root" - as here. I prefer to call it "admin" or "Administrators" and both "uid" and "gid" must match.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.