LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   file permissions (https://www.linuxquestions.org/questions/linux-newbie-8/file-permissions-255933/)

sentme_mail 11-17-2004 07:28 AM

file permissions
 
hi,
how can i set a file to be hidden to others but visible to the file owner?
thanks

trevelluk 11-17-2004 07:31 AM

chmod 700 <filename> will give the owner full permission on the file, and others no permissions at all. I don't think that will actually hide the file, but it will mean no one else can read it.

Alternatively, to hide everything in the directory, use chmod 700 <directory>. This will actually hide the directory contents from other users,

For more info, try man chmod

Hope this helps!

sentme_mail 11-17-2004 09:14 AM

after changing to 700, i have got:
You don't have permission to access / on this server.

Quote:

Originally posted by trevelluk
chmod 700 <filename> will give the owner full permission on the file, and others no permissions at all. I don't think that will actually hide the file, but it will mean no one else can read it.

Alternatively, to hide everything in the directory, use chmod 700 <directory>. This will actually hide the directory contents from other users,

For more info, try man chmod

Hope this helps!


Doolspin 11-17-2004 11:05 AM

Are you trying to hide '/'? as in the root dir?

sentme_mail 11-18-2004 03:43 AM

sub dir

Quote:

Originally posted by Doolspin
Are you trying to hide '/'? as in the root dir?

Doolspin 11-18-2004 09:46 AM

Looks like your where trying to hide your root dir. If thats even possible, you'd have to be root ;)

sentme_mail 11-18-2004 10:04 AM

so how can i hide a directory then?

tenmiles 11-18-2004 10:21 AM

i am kind of new at this, but i am pretty sure that if u chmod 770 that will give the owner and all users in ur group full permisions, but then everyone else will have no permissions. if u have a home comp this should work ok, but if u r in an office where there are multilple people in ur group then they would have full permissions to you stuff. if u use chmod 700 then u have to be root or the person who created the file. you could use chown to make all the files urs, but i dont know how to use it or if it will screw things up if u try it on system files. one guy did chmod 777 / and couldnt boot any more, so some things are better left alone

jschiwal 11-18-2004 11:32 AM

Don't hide your root directory. Many programs that need to run, run under their own user names. If you hide the root directory, they will not be able to read the /etc files or load in library files.
Your personal files will be in your home directory so that is where you want to change the permissions.
First check if there is a group by the same name as your user name. If not create it. Then change the group ownership of your own home directory to that group, and make that your primary group. Now reset the 'other' bits of the directory: chmod o-rwx /home/username

By clearing the execution bit of a directory for 'others'. Other users will not be able to enter your directory. If you are paranoid, you can change the permissions of all of the files and directories in your home directory using the -R option.

chmod -R o-rwx /home/username
chmod -R o-rwx/home/username/.*

You can search for files with other permissions set using the find command.

find ~/ -perm +o=rwx

Also, edit your ~/.profile to change the umask number to something like 0027
This is your file creation mask. If a program you are running creates a file with a file mask of 0755, the other permission bits will be masked out (i.e. cleared).

Your linux distribution probably has a service running periodically which will check permissions and reset them to default for certain directories. They have a gui configuration program that allow you to enter a directory and the default permissions.


All times are GMT -5. The time now is 01:19 AM.