Managing File permissions on Remote Host - RHCE.pdf
support8872
149 views
13 slides
Oct 09, 2024
Slide 1 of 13
1
2
3
4
5
6
7
8
9
10
11
12
13
About This Presentation
Slides on how to manage file permission on remote host using ansible - Part of RHCE syllabus
Size: 506.89 KB
Language: en
Added: Oct 09, 2024
Slides: 13 pages
Slide Content
Managing File Permissions on
Remote Host
●Manage file and directory properties, such as permissions, ownership on
remote systems
●Attributes
○Mode: sets the permissions of the file
○owner: Sets the owner as root
○group: Sets the group as root
○state: Ensures that the path is a directory/file
○path: Specifies the file whose permissions will be changed
●Execute the playbook
Command: playbook-ansible <file-name> .yml
●stat: To get the file/file system status
○Attributes
■path: Specifies the file path whose status need to be
gathered
■register: Registers the output of the stat module into a
container
○Link: stat — Ansible Documentation
Stat Module
Debug Module
●debug: To display variables or output custom messages during playbook
execution
○Attributes
■msg: To display the file status
○Link: debug module— Ansible Documentation
Check Directory Status
●Execute the playbook
Command: playbook-ansible <file-name> .yml
●Verify the creation of demo directory of remote host
Command: ls <directory_path> | grep <directory-name>
●Note the permissions of the file on remote host
Command: ls -ltr <directory_path>
Note: (-rw-r--r–) means the owner can read and write the file and it is
readable by the group and others
Older file permissions
Change File permissions
Note : 0777 permission grants read, write, and execute access to the owner,
group, and others.
●Execute the playbook on control node
Command: playbook-ansible <file-name> .yml
●Verify the changed permissions of the file on remote host
Command: ls -ltr <directory_path>
Changed file permissions
Note: After adding permissions now the file has (-rwx-rwx-rwx-) meaning it is
readable, writable and executable by the owner, group, and others