-1

I am new to RedHat 7. I am learning user management and file permission. how to give permissions to normal user. So that he can create a file..

[syed1@localhost /]$ touch f1
touch: cannot touch ‘f1’: Permission denied
2
  • 2
    Don't create file at /. Oct 31, 2017 at 10:16
  • please add some ls -l or other logs to help us understand what you are trying to do Oct 31, 2017 at 10:28

2 Answers 2

3

by default Normal user can create files under his home directory. So navigate to home directory of user with below command and create file.

# cd ~
# touch file1

if you want to create files outside home directory of user. Give sudo privileges to user.

0

You must have sudo permissions applied to normal user or root user login to create file in root(/) of filesystem. Mostly we don't need to create files at / so I recommend to use your home directory to create a files using Below command.

touch ~/file1 

where ~ symbol refers to your home directory

If its really necessary to create a file in /, you can use sudo command below command to create a file.

sudo touch f1

If you have dont have sudo permissions to user, then you have to login with root user and execute below command to edit the sudoers file.

visudo

Then add below line to the file and save the file

myuser ALL=(ALL) ALL

Now you can execute root privileged command using sudo before command.

You must log in to answer this question.

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