-1

To grant read and write permissions to the owner and to remove execution permission from the group should it be two commands as,

chmod u +rw Test
chmod g -x  Test

or could it be can done in a single command?

Simba
  • 23,537
  • 7
  • 64
  • 76

2 Answers2

1
$ chmod u+rw,g-x Test
$ ls -ls Test
0 -rwx-----x 1 dave  dave  0 Sep 30 09:28 Test
$ chmod -u-rw,g+x Test
$ ls -ls Test
0 ------x--- 1 dave  dave  0 Sep 30 09:28 Test
$ chmod u+rw,g-x Test
$ ls -ls Test
0 -rw------- 1 dave  dave  0 Sep 30 09:28 Test
kjohri
  • 1,166
  • 11
  • 10
1

To change directory permissions in Linux, use the following:

chmod +rwx filename to add permissions.
chmod -rwx directoryname to remove permissions.
chmod +x filename to allow executable permissions.
chmod -wx filename to take out write and executable permissions.

r: Read permissions. The file can be opened, and its content viewed.
w: Write permissions. The file can be edited, modified, and deleted.
x: Execute permissions. If the file is a script or a program, it can be run (executed).

We can change Using numbers as well chmod 754 filename 7 for owner (read write and execute), 5 for group(read and execute), 4 for other users (only read)

naran g
  • 51
  • 3