Skip to Content
Linux Shell Scripting Cookbook - Third Edition
book

Linux Shell Scripting Cookbook - Third Edition

by Clif Flynt, Sarath Lakshman, Shantanu Tushar
May 2017
Beginner
552 pages
28h 47m
English
Packt Publishing
Content preview from Linux Shell Scripting Cookbook - Third Edition

How to do it...

In order to set permissions for files, we use the chmod command.

Assume that we need to set the permission, rwx rw- r-.

Set these permissions with chmod:

    $ chmod u=rwx g=rw o=r filename

The options used here are as follows:

  • u: This specifies user permissions
  • g: This specifies group permissions
  • o: This specifies others permissions

Use + to add permission to a user, group, or others, and use - to remove the permissions.

Add the executable permission to a file, which has the permission, rwx rw- r-:

    $ chmod o+x filename

This command adds the x permission for others.

Add the executable permission to all permission categories, that is, for user, group, and others:

    $ chmod a+x filename

Here a means all.

In order to remove ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Mastering Linux Shell Scripting - Second Edition

Mastering Linux Shell Scripting - Second Edition

Mokhtar Ebrahim, Andrew Mallett

Publisher Resources

ISBN: 9781785881985