In: Computer Science
LINUX command line / virtual box.
Please UPVOTE
(a) make it executable
To create a file in Linux , we can use the touch command.
Command:
touch file
In order to give executable permission , we use the chmod command followed by '-x' and the file name.
Command:
chmod +x file
(b) enable the SUID
chmod u+s file
u+s gives the SUID
ls -l command should show you whether SUID is applied or not. Simply look at the first field of ls -l output. The s in -rwsr-xr-x indicates SUID bit.
In some cases you will see a capital S instead of a small s that we saw above. Captal S indicates that there is no executable permission applied to that file/or script.
Command used:
chmod u+s file
ls -l file
(c) use the ACL to add a permission for the root user.
We need to run the setfacl command with below format to set ACL on the given file. We are going to give a rwx (read write execute) access to root user as asked in question on the created file named 'file'.
Command used:
setfacl -m u:root:rwx file
setfacl:
Command-m:
modify the current ACL(s) of
file(s)u:
Indicates a userroot:
Name of the userrwx:
Permissions which you want
to setfile:
Name of the fileTo check the default ACL values for a file or directory, use the
getfacl
command followed by /path to file
or /path to folder
.
If you have any doubts or any modifications, please comment and I'll help you out.
Please UPVOTE