RTEMS Logo

RTEMS 4.10.0 On-Line Library


File and Directory Commands chmod - change permissions of a file

PREV UP NEXT Bookshelf RTEMS Shell User's Guide

3.2.12: chmod - change permissions of a file

SYNOPSYS:

chmod permissions file1 [file2...]

DESCRIPTION:

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.

EXIT STATUS:

This command returns 0 on success and non-zero if an error is encountered.

NOTES:

The chmod command only takes numeric representations of the permissions.

EXAMPLES:

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

CONFIGURATION:

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.

PROGRAMMING INFORMATION:

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;


PREV UP NEXT Bookshelf RTEMS Shell User's Guide

Copyright © 1988-2008 OAR Corporation