Mailing List
Home
Forum Home
Linux - General Red Hat Linux discussion list
Installation - Getting started with Red Hat Linux
Enterprise Linux 3 - Discussion of Red Hat Enterprise Linux 3 (Taroon)
Red Hat Linux 9 - Discussion of Red Hat Linux 9 (Shrike)
Red Hat Linux 7.2 - Discussion of Red Hat Linux 7.2 (Enigma)
Red Hat Linux 7.3 - Discussion of Red Hat Linux 7.3 (Valhalla)
Apache Web Server
Oracle database, Microsoft SQL server ...
Subjects
Subject: application/x mplayer2 plugin
RPM error: db4 error(16) from dbenv >remove: Device or resource
   busy
Command stream end of file while reading
Subject: X Windows problem (xauth)
Subject: Upgrading openoffice 1 1 rpm
Subject: FTP: connection refused
Subject: FTP: connection refused
mount: /dev/cdrom: is not a valid block device
Dell Precision 650, RedHat 9, no sound
how to trace the cause resulting in the crash of bind server
Virus on the list
UNINSTALL RPM MYSQL
usb pen drives: mounting as a user
Subject: broadcom network interface
make mrproper
Couldn 't open PID file /var/run/named/named pid Permission denied
sendmail configuration on redhat
kernel 2 6 and /dev/sound/mixer not found
Subject: Promise 378 controller
Subject: Problem using up2date
mrtg step by step howto/configuration for a newbie?
Compiling and Installing Kernel 2 6
Can 't locate module ppp0, can 't locate module ppp compress 21
Subject: Lotus Notes under Wine
HOW I CAN MAKE BOOTABLE FLOPPY DISKET
/etc/security/limits conf question
Intel E/1000 driver
rpm database corrupt
Command stream end of file while reading
qla2300 modules
 
Files & permissions

Files & permissions

2004-07-21       - By Andreas Lund

 Back
Reply:     1     2     3     4  

Wed, 21 Jul 2004 15:51:31 +0100, "Harry Hambi" <harry.hambi@(protected)> wrote:
> Understand....lets say there's only one file I wish only read access
> to,I don't want them logging on as me, can I create a separate log on, &
> give them read only access to this one file?.

You can do this in a number of ways, but the simplest (if there are only the
two of you) is to grant "everyone" read access to the file. Incidently, this
is usually the default when you create a file:

[root@(protected) root]# touch my_file      
[root@(protected) root]# ls -l my_file
-rw-r--r--    1 root     root            0 Jul 21 17:20 my_file

But let's say I have a file with the following permissions set:

[root@(protected) root]# ls -l my_file      
-rw-- ----    1 root     root            0 Jul 21 17:20 my_file

As you can see from the privilege flags, Only the root user has read/write
access to this file. I can grant read access to everyone like this:

[root@(protected) root]# chmod +r my_file
[root@(protected) root]# ls -l my_file    
-rw-r--r--    1 root     root            0 Jul 21 17:20 my_file


Another way to do it is if you create a group, make the other user member of
that group, and then change group ownership and permissions of the file. Like
so: (I'll call your friend "steve" if that's okay with you ;-)

[root@(protected) root]# ls -l my_file      
-rw-- ----    1 root     root            0 Jul 21 17:20 my_file
[root@(protected) root]# groupadd friends
[root@(protected) root]# usermod steve -G steve,friends
[root@(protected) root]# chgrp friends my_file
[root@(protected) root]# chmod g+r my_file
[root@(protected) root]# ls -l my_file      
-rw-r-- --    1 root     friends         0 Jul 21 17:20 my_file


Or you could just change group ownership of the file to his personal group:

[root@(protected) root]# ls -l my_file      
-rw-- ----    1 root     root            0 Jul 21 17:20 my_file
[root@(protected) root]# chgrp steve my_file
[root@(protected) root]# chmod g+r my_file
[root@(protected) root]# ls -l my_file      
-rw-r-- --    1 root     steve           0 Jul 21 17:20 my_file


As you can see, there are a lot of different ways to solve this, which one you
choose depends on the circumstances. Will other users need access to the same
file(s) in the future? What's in the file? How is the file used, is it static
or is it updated by you or perhaps a program? Some programs are picky about
file ownership and permissions.

In the end, to pick the perfect solution you need to understand the UN*X file
permission model. Unfortunately it's quite primitive compared to what you'll
find in, say, Netware or even Windos today. For that kind of fine-grained
control you need to use server software like Samba or an FTP server.


ps.

Yes, I usually do everything as "root" on my servers.
It's a bad habit, I know ;-)

--
Andreas Lund (floyd@(protected))
Tel: +47 90.07.71.62 / +47 63.88.33.56
Ano-Tech Computers (http://www.atc.no/)
** He had a baseball bat and I was tied to a chair.
** Pissing him off was the smart thing to do.  -- Max Payne


__ ____ ____ ____ ____ ____ ____ ____ ____ ____
Valhalla-list mailing list
Valhalla-list@(protected)
https://www.redhat.com/mailman/listinfo/valhalla-list