LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 11-17-2004, 07:28 AM   #1
sentme_mail
Member
 
Registered: Sep 2002
Posts: 59

Rep: Reputation: 15
file permissions


hi,
how can i set a file to be hidden to others but visible to the file owner?
thanks
 
Old 11-17-2004, 07:31 AM   #2
trevelluk
Member
 
Registered: Nov 2003
Location: Bristol, UK
Distribution: Debian Lenny, Gentoo (at work)
Posts: 388

Rep: Reputation: 32
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!
 
Old 11-17-2004, 09:14 AM   #3
sentme_mail
Member
 
Registered: Sep 2002
Posts: 59

Original Poster
Rep: Reputation: 15
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!
 
Old 11-17-2004, 11:05 AM   #4
Doolspin
Member
 
Registered: Aug 2004
Location: Ohio
Distribution: Slackware 9.1/10/10.1 RedHat circa 2000, Knoppix, OpenSuse 10.0/10.1
Posts: 122

Rep: Reputation: 15
Are you trying to hide '/'? as in the root dir?
 
Old 11-18-2004, 03:43 AM   #5
sentme_mail
Member
 
Registered: Sep 2002
Posts: 59

Original Poster
Rep: Reputation: 15
sub dir

Quote:
Originally posted by Doolspin
Are you trying to hide '/'? as in the root dir?
 
Old 11-18-2004, 09:46 AM   #6
Doolspin
Member
 
Registered: Aug 2004
Location: Ohio
Distribution: Slackware 9.1/10/10.1 RedHat circa 2000, Knoppix, OpenSuse 10.0/10.1
Posts: 122

Rep: Reputation: 15
Looks like your where trying to hide your root dir. If thats even possible, you'd have to be root
 
Old 11-18-2004, 10:04 AM   #7
sentme_mail
Member
 
Registered: Sep 2002
Posts: 59

Original Poster
Rep: Reputation: 15
so how can i hide a directory then?
 
Old 11-18-2004, 10:21 AM   #8
tenmiles
Member
 
Registered: Nov 2004
Distribution: fedora core 3
Posts: 43

Rep: Reputation: 15
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
 
Old 11-18-2004, 11:32 AM   #9
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682
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.

Last edited by jschiwal; 11-18-2004 at 11:36 AM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
file permissions OK, but command permissions? stabu Linux - General 2 10-05-2005 12:00 PM
locking a usage policy file/ftp file permissions gbow Linux - Newbie 0 02-16-2004 05:35 AM
CVS - file permissions and file ownership Osten Linux - Software 3 01-18-2004 04:08 PM
file permissions and file owner won't change Nadim Slackware 5 11-29-2003 06:03 PM
Changing file permissions on a SAMBA file share apenney Linux - Software 0 02-11-2002 04:42 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 03:14 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration