Prevent other users from seeing the file.
In Linux, you can prevent other users from seeing a file by using the chmod command to change the file's permissions.
Other users are other users who belong to the file's owner group, and other users.
Change file permissions to prevent other users from seeing the file. [root@lion root]# echo "test text" > /tmp/samptxt [root@lion root]# ls -l /tmp/samptxt -rw-r--r-- 1 root root 5 Mar 5 01:23 /tmp/samptxt ↑Create a file (samptxt) in the /tmp directory labeled "test text" [root@lion root]# chmod 600 /tmp/samptxt [root@lion root]# ls -l /tmp/samptxt -rw------- 1 root root 5 Mar 5 01:23 /tmp/samptxt ↑Use the chmod command to change the permissions of the samptxt file to 600 [root@lion root]# cat /tmp/samptxt test text ↑Use the cat command to view the contents of the read_only file [root@lion root]# su - nuy [nuy@lion nuy]$ cat /tmp/samptxt cat: /tmp/samptxt: permission. error ↑I'm trying to browse files as another user, but I can't see them due to permission errors. |