LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 02-02-2010, 08:53 PM   #1
BrianK
Senior Member
 
Registered: Mar 2002
Location: Los Angeles, CA
Distribution: Debian, Ubuntu
Posts: 1,334

Rep: Reputation: 51
Can you make a symbolic link read only?


Short version: Can you make a symlink read only? I mean the link itself, not the file to which it points.


Long version: I have about 100 users who all have a .login. They like to modify their .login, which is fine in most cases, but sometimes they do it wrong & it screws up a LOT of the things they are supposed to be doing. Because of this, I'm going to lock down all .logins & I thought, "wouldn't it be nice if we could modify one file & all users would get the modification?" So I'm currently testing having everyone's .login point to a central .login via symlink. It works fine, but it appears that the users can [re]move the link & replace it with a file, thus defeating the purpose.
The question, then, is: Can I lock down the symlink so the user cannot move or remove the link? FWIW, it must be a symbolic link (as opposed to a hard link) as the file it points to is on an NFS share (not the same file system).

Last edited by BrianK; 02-02-2010 at 08:56 PM.
 
Old 02-02-2010, 09:43 PM   #2
David the H.
Bash Guru
 
Registered: Jun 2004
Location: Osaka, Japan
Distribution: Arch + Xfce
Posts: 6,852

Rep: Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037
The permissions of a file control whether the user can modify the contents of it. But whether a user can create, delete, or rename a file depends on the permissions of the directory it's in, not on the permissions of the file itself.

http://en.wikipedia.org/wiki/File_sy...ns#Permissions

It can help to think of a directory as just another kind of file; one that keeps a list of all the other files that are "in" it. Only people who can modify the directory "file" can control what's in that directory.

Trying to change the file permissions of a symlink is pointless, because there are no contents to modify.

Last edited by David the H.; 02-02-2010 at 09:48 PM. Reason: edited for clarity
 
Old 02-03-2010, 12:26 AM   #3
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,358

Rep: Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751
What you can do if you want to be ruthless is setup the central .login (or just use /etc/profile) and as part of the login process, have it remove any local-to-user .log/.bash_profile etc before it hands over ctrl to the user.
 
Old 02-17-2010, 08:11 PM   #4
BrianK
Senior Member
 
Registered: Mar 2002
Location: Los Angeles, CA
Distribution: Debian, Ubuntu
Posts: 1,334

Original Poster
Rep: Reputation: 51
Sorry for the delay in my response, but thanks for the comments.

I believe I'm going to make the default /etc/csh.chsrc or /etc/bash.bashrc point to the central file that sets up a "company sanctioned" environment & allow the users to go to town on their own ~/.login. This way, we can simply move the user's ~/.login out of the way if they do it wrong.
 
  


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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to make a symbolic link ? chrislabricole Red Hat 5 01-29-2009 06:44 AM
Ubuntu unable to read the symbolic link for Java? alexs Linux - Newbie 2 08-02-2008 02:09 AM
The command to make a symbolic link Gins Linux - General 10 11-12-2006 01:58 PM
cannot make symbolic link dave`2005 Debian 3 10-08-2005 10:15 AM
How to make symbolic link? Tommi Linux - General 9 05-07-2003 08:58 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 02:57 PM.

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