file change-owner
Syntax
file change-owner filename <user user> <group group> <to to> <recurse>
Description
Change the ownership of a file to a specified user, group or both.
Options
filename |
Filename to change owner. |
user |
New owner of the file. |
group |
New group of the file. |
to |
New owner:group of the file. |
recurse |
Operate recursively. Changes the ownership of all files and subdirectories within the specified directory. |
Required Privilege Level
maintenance
Sample Output
- file change-owner (user)
- file change-owner (group)
- file change-owner (to)
- file change-owner (recurse)
file change-owner (user)
The following sample command changes the owner of /var/tmp/config.txt to labuser. The group remains unchanged.
user@host> file change-owner user labuser /var/tmp/config.txt
file change-owner (group)
The following sample command changes the group of /var/tmp/config.txt to staff. The user remains unchanged.
user@host> file change-owner group staff /var/tmp/config.txt
file change-owner (to)
The following sample command sets the owner of the file to labuser and the group to staff.
user@host> file change-owner to labuser:staff /var/tmp/config.txt
file change-owner (recurse)
The following sample command recursively changes the ownership of all files and subdirectories within /var/home/john/config-dir directory.
user@host> file change-owner recurse /var/home/john/config-dir user user1 user@host:~ # file list detail /var/home/john/config-dir total 1 -rw-r--r-- 1 user1 20 0 Jun 16 15:13 1.conf drwxr-xr-x 2 user1 20 512 Jun 16 15:13 archive-dir
Release Information
Command introduced before Junos OS Release 7.4.