Sunday 27, Apr 2025
We are moved to new domain
Click -> www.ehowtonow.com
Sunday, 9 July 2017

Change Access Permission chmod Linux Command

Change Access Permission chmod Linux Command

chmod

chmod [options] mode files chmod [options] --reference=filename files

Change the access mode (permissions) of one or more files. Only the owner of a file or a privileged user may change the mode. mode can be numeric or an expression in the form of who opcode permission. who is optional (if omitted, default is a); choose only one opcode. Multiple modes are separated by commas.

Options

-c, --changes
Print information about files that are changed.

-f, --silent, --quiet

Do not notify user of files that chmod cannot change.

--help

Print help message and then exit.

-R, --recursive

Traverse subdirectories recursively, applying changes.

--reference=filename

Change permissions to match those associated with filename.

-v, --verbose

Print information about each file, whether changed or not.

--version
Print version information and then exit.

Who


u

User.

g

Group.

o

Other.

a

All (default).

Opcode


+

Add permission.

-

Remove permission.

=

Assign permission (and remove permission of the unspecified fields).


Permissions


r

Read.

w

Write.

x

Execute.

s

Set user (or group) ID.

t

Sticky bit; used on directories to prevent removal of files by non-owners.

u

User's present permission.

g

Group's present permission.

o

Other's present permission.

Alternatively, specify permissions by a three-digit octal number. The first digit designates owner permission; the second, group permission; and the third, other's permission. Permissions are calculated by adding the following octal values:

4

Read.

2

Write.

1

Execute.

Note that a fourth digit may precede this sequence. This digit assigns the following modes:

4

Set user ID on execution to grant permissions to process based on the file's owner, not on permissions of the user who created the process.

2

Set group ID on execution to grant permissions to process based on the file's group, not on permissions of the user who created the process.

1

Set sticky bit.

Examples


Add execute-by-user permission to file:

chmod u+x file

Either of the following will assign read/write/execute permission by owner (7), read/execute permission by group (5), and execute-only permission by others (1) to file:

chmod 751 file chmod u=rwx,g=rx,o=x file

Any one of the following will assign read-only permission to file for everyone:

chmod =r file chmod 444 file chmod a-wx,a+r file

The following makes the executable setuid, assigns read/write/execute permission by owner, and assigns read/execute permission by group and others:

chmod 4755 file

Reference : http://www.linuxdevcenter.com

Shop and help us

Flipkart Offer Snapdeal offer Amazon.in offer Amazon.com offer

Related Posts:

  • ssh-add - Linux Command ssh-add ssh-add [options] [files] ssh-add -e|-s reader Add RSA or DSA identities to the authentication agent (see ssh-agent), which must be running and must be an ancestor of the current process. ssh-add reads the files c… Read More
  • Create or change a password using passwd Linux Command passwd passwd [options] [user] Create or change a password associated with a user name. Only the owner or a privileged user may change a password. Owners need not specify their user name. Users can change their own passwo… Read More
  • ssh-agent - Linux Command ssh-agent ssh-agent [options] [command [arguments] ] Hold private keys used for public key authentication. ssh-agent is usually executed at the beginning of an X or login session; then all other windows or programs given … Read More
  • man Linux Command man man [options] [section] [title] Display information from the online reference manuals. man locates and prints the named title from the designated reference section. Traditionally, manpages are divided into nine sect… Read More
  • ssh-keyscan - Linux Commands ssh-keyscan ssh-keyscan [options] Gather public and private host keys from a number of hosts. Can be used in scripts. Options -4 Use IPv4 addresses only. -6 Use IPv6 addresses only. -f file Read hostnames or addrlist… Read More
  • Blogger Comments
  • Facebook Comments
  • Disqus Comments

0 comments:

Post a Comment

Item Reviewed: Change Access Permission chmod Linux Command Rating: 5 Reviewed By: eHowToNow