chmod not working in a non super user

10,716

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.

Share:
10,716

Related videos on Youtube

Johny Nassar
Author by

Johny Nassar

Updated on September 18, 2022

Comments

  • Johny Nassar
    Johny Nassar almost 2 years

    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

    • Andrea Corbellini
      Andrea Corbellini over 8 years
      1. please copy & paste output instead of screenshots; 2. to use sudo in Ubuntu you need to be in the sudo group (or you need to be in the sudoers file like the error suggests); 3. you're getting "no such file or directory" because you forgot to cd to the right directory
    • Johny Nassar
      Johny Nassar over 8 years
      What's the right directory? It should be in ABC user, right?
    • Andrea Corbellini
      Andrea Corbellini over 8 years
      No, you created the files in your home directory, they can't be in ABC's home directory: cd ~batman; chmod 744 *.txt -- but you may get errors depending on the directory permissions
    • Johny Nassar
      Johny Nassar over 8 years
      I'm new to Ubuntu so I don't get it 100% the group idea. Sorry.
    • Johny Nassar
      Johny Nassar over 8 years
      But the ABC user is the new owner of this file. Right? How can I fix it ?
    • Johny Nassar
      Johny Nassar over 8 years
      @AndreaCorbellini I didn't understand, plz could you explain more
  • Johny Nassar
    Johny Nassar over 8 years
    I have some questions: 1. How can I make a home directory for ABC. 2. When I make a chmod, It's obligatory that I must go to the file location? 3.When I tried to chmod in the batman it's successfully completed and there's no problem with that!! Why? Thanks.