5

I want certain files to be able to be altered by myself on my basic account. To me, they are high priority files, with many backups. But we have some young'uns in the house and I don't quite trust them. I feel like they will find a way to delete the files. Is there a way I could hide them, or make them invisible without a command needed to be input from the command line?

3
  • how these young-ins access your file using your own account or their account ? Nov 22, 2014 at 4:30
  • I only have the one account, and they know the root password... They are not total nincompoops, but I just want to make sure... I even have the files saved on a flash-drive. Nov 22, 2014 at 4:34
  • i have edited and added a line at the end Nov 22, 2014 at 4:46

3 Answers 3

8

Directory permissions:

  • The write bit allows the affected user to create, rename, or delete files within the directory, and modify the directory's attributes
  • The read bit allows the affected user to list the files within the directory
  • The execute bit allows the affected user to enter the directory, and access files and directories inside
  • The sticky bit states that files and directories within that directory may only be deleted or renamed by their owner (or root)

You can save the files under the ownership of root user and thus this will require them to use password before accessing those files.
As said in directory permissions, you can take away 'write bit' and 'execute bit' thus not allowing them to enter directory. only give them read permission so that they can view files without altering and deleting them.
you can learn the use of sticky bit (link here) and disabling alter and delete feature on every file inside that directory

If they have root password then hiding files is only the way to protect your files and root is god of the system, if they have root password, so they are the real god of your system !

2

If they have the root password, as you say in a comment, there is no way to prevent them doing anything with the file because they can always just su(do) to edit or delete it.

If you don't want to remove their root access by changing the password and either changing their accounts group memberships or editing the sudoers file, about the only thing you can do is use chmod to remove group & other permisions to write to the file ('chmod go-w filename') and make sure that it is owned by root ('chown root:root filename'). That way they can't do anything to it accidentally with their own accounts, but will have to deliberately su(do) in order to affect it.

0

If you have files in a folder, you want to hide, you can simply add . before the name and are able to see them in a file manager using some keyboard shortcut to display hidden files (ALT + . for example).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.