LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Linux From Scratch
User Name
Password
Linux From Scratch This Forum is for the discussion of LFS.
LFS is a project that provides you with the steps necessary to build your own custom Linux system.

Notices


Reply
  Search this Thread
Old 09-23-2005, 10:31 AM   #1
satimis
Senior Member
 
Registered: Apr 2003
Posts: 3,695

Rep: Reputation: 56
Question on permission


Hi folks,

BLFS 6.1

On this box only root is allowed to mount CDRom and Floppy drive.

bash-3.00$ mount /dev/hdd /mnt/cdrom/
Code:
mount: only root can do that
bash-3.00$ mount /dev/fd0 /mnt/floppy/
Code:
mount: only root can do that
root@localhost:/home/satimis# ls -l /dev/hdd
Code:
brw-rw----  1 root root 22, 64 Sep 24 05:59 /dev/hdd
bash-3.00$ cat /etc/group
Code:
root:x:0:
bin:x:1:
sys:x:2:
sys:x:2:
kmem:x:3:
tty:x:4:
tape:x:5:
daemon:x:6:
floppy:x:7:
disk:x:8:
lp:x:9:
dialout:x:10:
#audio:!:11:satimis
audio:11:satimis
video:x:12:
utmp:x:13:
usb:x:14:
satimis:x:100:
cdrom:x:101:
I tried to anthenticate "satimis" to mount those devices by making following changes

1)
root@localhost:/home/satimis# chown root:cdrom /dev/hdd
root@localhost:/home/satimis# ls -l /dev/hdd
Code:
brw-rw----  1 root cdrom 22, 64 Sep 24 05:59 /dev/hdd
2)
Added "satimis" to the respective groups with Nano on /etc/group
Code:
root:x:0:
bin:x:1:
sys:x:2:
sys:x:2:
kmem:x:3:
tty:x:4:
tape:x:5:
daemon:x:6:
floppy:x:7:satimis
disk:x:8:
lp:x:9:
dialout:x:10:
#audio:!:11:satimis
audio:11:satimis
video:x:12:
utmp:x:13:
usb:x:14:
satimis:x:100:
cdrom:x:101:satimis
But still failed. Please advise.

bash-3.00$ cat /etc/fstab
Code:
]# Begin /etc/fstab

# file system  mount-point    type    options                              dump  fsck
#                                                                             order

/dev/hda6      /              ext3    defaults                                1  1
/dev/hda3      swap           swap    pri=1                                   0  0
proc           /proc          proc    defaults                                0  0
sysfs          /sys           sysfs   defaults                                0  0
devpts         /dev/pts       devpts  gid=4,mode=620                          0  0
shm            /dev/shm       tmpfs   defaults                                0  0
/dev/fd0       /mnt/floppy    auto    noauto,owner,kudzu                      0  0
usbfs          /proc/bus/usb  usbfs   devgid=14,devmode=0660                  0  0
/dev/hdc       /mnt/cdwriter  iso9660 user,iocharset=ios8859-1,noauto,ro,exec 0  0
/dev/hdd       /mnt/cdrom     iso9660 user,iocharset=iso8859-1,noauto,ro,exec 0  0

# End /etc/fstab
Furthermore is there another way adding "satimis" on /etc/group without using Nano to do the job?

TIA

B.R.
satimis
 
Old 09-23-2005, 11:32 AM   #2
Whitesocks
Member
 
Registered: Sep 2005
Posts: 30

Rep: Reputation: 15
You can make the cdrom mount during boot (if there is a CD in it) by having something like this in your fstab:

/dev/cdrom /media/cdrom iso9660 ro,gid=100,users,unhide 0 0

This line will mount the cdrom at boot if there is a CD in it. The gid=100 means that every file on the CD will belong to the group id 100. Files are still owned by root, but every user i add to group 100 will be in the same group as the mounted files. The mount manpage is good to read, but if you dont want to, there are example setups on the web if you google for it.



If you dont have a CD in the drive during boot, it will not get mounted. My suggestion is to install the sudo package. Then you will be able to type 'sudo mount /dev/cdrom /media/cdrom' and the mount command will be run as root. You can specify what commands you want to be able to run by changing the config file with the visudo command. Its all in the documentation for sudo. =)

There is also programs to auto-mount the cdrom when you need it, but i havent had the need to install them yet. I dont mount different cdrom's alot myself.

The BLFS book mentions Autofs for example - http://www.linuxfromscratch.org/blfs...fs/autofs.html - have a look if you want.

And yes, you can add users to the /etc/group file with 'groupadd'. Read manpage for details.

Last edited by Whitesocks; 09-23-2005 at 11:35 AM.
 
Old 09-26-2005, 05:58 AM   #3
satimis
Senior Member
 
Registered: Apr 2003
Posts: 3,695

Original Poster
Rep: Reputation: 56
Hi Whitesocks,

Tks for your detail advice.

Quote:
You can make the cdrom mount during boot (if there is a CD in it) by having something like this in your fstab:

/dev/cdrom /media/cdrom iso9660 ro,gid=100,users,unhide 0 0

This line will mount the cdrom at boot if there is a CD in it.
I don't have the need to mount CD on booting. However I'm interested to learn. I have following 2 lines on /etc/fstab;
Code:
/dev/hdc       /mnt/cdwriter  iso9660 user,iocharset=ios8859-1,noauto,ro,exec 0  0
/dev/hdd       /mnt/cdrom     iso9660 user,iocharset=iso8859-1,noauto,ro,exec 0  0
What are the difference between them and your suggestion?

On FC3 /etc/fstab
Code:
/dev/hdd                /media/cdrom1           auto    pamconsole,exec,noauto,fscontext=system_u:object_r:removable_t,managed 0 0
/dev/hdc                /media/cdrecorder1      auto    pamconsole,exec,noauto,fscontext=system_u:object_r:removable_t,managed 0 0
they were default on installing FC3. I tried to change /media/cdrom1 as /mnt/cdrom and /media/cdrecorder1 as /mnt/cdwriter.

$ ls /mnt/
Code:
cdrom  cdwriter  lfs  livecd
After reboot it recreated another 2 lines as before

On User screen there are 4 CD icons;
CD Recorder1 (default)
CD-ROM Device (created by me)
CD-ROM (hdd) (default)
CDWRITER Device (created by me)

The default icons after removed will come back again on reboot.

Quote:
The gid=100 means that every file on the CD will belong to the group id 100. Files are still owned by root, but every user i add to group 100 will be in the same group as the mounted files.
Whether you meant adding 'user_1, 'user_2', etc. to /etc/group as
Code:
....
user_1:x:100: 
user_2:x:100:
etc.
Others noted with thanks

BR
satimis
 
Old 09-27-2005, 12:27 AM   #4
shotokan
Member
 
Registered: Mar 2005
Distribution: slackware, LFS
Posts: 204

Rep: Reputation: 30
I find that using autofs (automount) is better then fstab for things like mounting the cdrom, cdrw, or floppy drive.
 
Old 09-27-2005, 02:16 AM   #5
satimis
Senior Member
 
Registered: Apr 2003
Posts: 3,695

Original Poster
Rep: Reputation: 56
Hi shotokan,

Quote:
I find that using autofs (automount) is better then fstab for things like mounting the cdrom, cdrw, or floppy drive.
Whether you meant removing all entries of;

floppy
cdrom
cdrw

on /etc/fstab and perform all steps on
http://www.linuxfromscratch.org/blfs...fs/autofs.html

Tks

BR
satimis
 
Old 09-28-2005, 02:42 AM   #6
shotokan
Member
 
Registered: Mar 2005
Distribution: slackware, LFS
Posts: 204

Rep: Reputation: 30
Quote:
Whether you meant removing all entries of;

floppy
cdrom
cdrw

on /etc/fstab...
It doesn't matter if you leave the entries in fstab or not. I find it works regarded of whats in fstab.


Note: When using autofs (automount) for it to mount you have to try to access it first.
(in other words, the directories won't appear until you use a commad access them)

Example:
Code:
ls /media/cd
or
Code:
cd /media/cd
The directory will be different depending on how you set autofs up.
 
  


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
Permission question satimis Linux - General 7 09-29-2005 01:53 AM
Another permission question javamdk Ubuntu 6 08-20-2005 09:09 AM
a question about file permission tony yu Mandriva 5 04-13-2004 10:18 AM
FTP permission Question Supp0rtLinux Linux - Software 2 04-29-2003 07:03 PM
Permission question, (short) Stingreen Linux - General 5 03-14-2002 11:19 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Linux From Scratch

All times are GMT -5. The time now is 11:40 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