chmod 700 on behalf of another user

0

1

The Arch wiki states to ensure that the .xsession file in your home directory should be executable when configuring xdm

$ chmod 700 ~/.xsession

If I am running my install via a script as root,this command will give only root the necessary permissions. What command can I run to give a user the correct permissions to this file when running as root?

ZR_

Posted 2019-05-26T20:00:22.610

Reputation: 63

1I think you simply need to chown file to user:user instead. – the.malkolm – 2019-05-26T20:14:06.903

Answers

0

chmod changes the abilties of the file, if it can be executed, read and written. It applies these abilties for three groups (ignoring extended attributes). These groups are user, group and world.

So, chmod lets you say make a file readable, by user. 'User' ni this case is decided by whomever owns the file.

The owner can be changed using chown.

With this in mind, you likely need to chmod the file to have +r (read) set, and it likely needs to be owned by the user who'll be running it.

chmod 700 ~/.xsessions chown user

Replacing 'user' with the username of the user who'll be running the session.

Also note, it's refering to the file by using the 'shortcut' ~, which is replaced by /home/user/, so if you were calling this as root, and your user is called ZR_ you'll need to run:

chmod 700 /home/ZR_/.xsessions chown /home/ZR_/.xsessions ZR_

djsmiley2k TMW

Posted 2019-05-26T20:00:22.610

Reputation: 5 937

1I ran second line as chown ZR_ /home/ZR_/.xsessions and worked great. Thanks. – ZR_ – 2019-05-26T23:42:45.507