chmod permissions file1 [file2...]
This command changes the permissions on the files specified to the
indicated permissions
. The permission values are POSIX based
with owner, group, and world having individual read, write, and
executive permission bits.
This command returns 0 on success and non-zero if an error is encountered.
The chmod
command only takes numeric representations of
the permissions.
The following is an example of how to use chmod
:
SHLL [/] # cd etc SHLL [/etc] # ls -rw-r--r-- 1 root root 102 Jan 01 00:00 passwd -rw-r--r-- 1 root root 42 Jan 01 00:00 group -rw-r--r-- 1 root root 30 Jan 01 00:00 issue -rw-r--r-- 1 root root 28 Jan 01 00:00 issue.net 4 files 202 bytes occupied SHLL [/etc] # chmod 0777 passwd SHLL [/etc] # ls -rwxrwxrwx 1 root root 102 Jan 01 00:00 passwd -rw-r--r-- 1 root root 42 Jan 01 00:00 group -rw-r--r-- 1 root root 30 Jan 01 00:00 issue -rw-r--r-- 1 root root 28 Jan 01 00:00 issue.net 4 files 202 bytes occupied SHLL [/etc] # chmod 0322 passwd SHLL [/etc] # ls --wx-w--w- 1 nouser root 102 Jan 01 00:00 passwd -rw-r--r-- 1 nouser root 42 Jan 01 00:00 group -rw-r--r-- 1 nouser root 30 Jan 01 00:00 issue -rw-r--r-- 1 nouser root 28 Jan 01 00:00 issue.net 4 files 202 bytes occupied SHLL [/etc] # chmod 0644 passwd SHLL [/etc] # ls -rw-r--r-- 1 root root 102 Jan 01 00:00 passwd -rw-r--r-- 1 root root 42 Jan 01 00:00 group -rw-r--r-- 1 root root 30 Jan 01 00:00 issue -rw-r--r-- 1 root root 28 Jan 01 00:00 issue.net 4 files 202 bytes occupied
This command is included in the default shell command set.
When building a custom command set, define
CONFIGURE_SHELL_COMMAND_CHMOD
to have this
command included.
This command can be excluded from the shell command set by
defining CONFIGURE_SHELL_NO_COMMAND_CHMOD
when all
shell commands have been configured.
The chmod
is implemented by a C language function
which has the following prototype:
int rtems_shell_rtems_main_chmod( int argc, char **argv );
The configuration structure for the chmod
has the
following prototype:
extern rtems_shell_cmd_t rtems_shell_CHMOD_Command;
Copyright © 1988-2008 OAR Corporation