Glam Prestige Journal

Bright entertainment trends with youth appeal.

I have created a file named *.txt in /home using following command:

sudo nano *.txt

Then I have changed owner of *.txt to a user that I've created:

sudo useradd -c "ABC"

sudo chown ABC *.txt

I login to ABC by typing:

sudo login ABC

I tried to change permission of the file:

sudo chmod 777 *.txt

This is the result:

ABC is not in the sudoers file. This incident will be reported.

Permissions have successfully changed when running chmod from the original user: batman.

How can I change the permissions of *.txt from the new owner?

This is inside <code>ABC</code> user

6

2 Answers

All I need to do is to be in the directory which contains the file. Solution:

cd home

chmod 777 *.txt

That's all. But be aware to change the name of the file because the * in *.txt isn't a valid name.

If you step through your commands and the output these are your problems.

The file *.txt is located in batman's home directory.

  1. Switch to ABC user: sudo login ABC. You just made ABC and it doesn't have a home directory so you got thrown into the root directory

  2. You try chmod 777 *.txt, but you are in the root dir and the file is not there.

  3. You exit back into batman and try to chmod the file, but now it belongs to ABC and batman can't change it.

To Solve:

login as batman

su ABC
cd /home/batman
chown 777 *.txt
1

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

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