LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 04-11-2004, 06:32 PM   #1
imagreg
Member
 
Registered: Mar 2004
Distribution: Slackware 10.0
Posts: 76

Rep: Reputation: 15
Need Help with Permissions


Hi All,

I am fairly new to Slackware and just about have it set up the way that I want it. My biggest problem is setting permissions so that I can run programs as user and not root. Can someone help me. I would be very grateful. :-) For instance, I installed GtKam and K3b from source. I can run both of these from root however I can't get them working when I log in as user. Thanks!

Greg
 
Old 04-11-2004, 07:08 PM   #2
sharpie
Member
 
Registered: Jan 2004
Location: California
Distribution: Slackware 10.1
Posts: 190

Rep: Reputation: 30
Perhaps you don't have the path they were installed in in your $PATH? I'm not familiar with these programs but perhaps you could tell us an error message when you try running them? If it says no such command then it probably isn't in your path. You can either make a symbolic link to the program in one of the directories in your path, or add the directory to your path. If you need help with this let me know.
 
Old 04-11-2004, 07:12 PM   #3
imagreg
Member
 
Registered: Mar 2004
Distribution: Slackware 10.0
Posts: 76

Original Poster
Rep: Reputation: 15
Thanks for the reply. What I need to learn is how to add a user to a group. Do you know how to do this? Thanks in advance!
 
Old 04-11-2004, 07:26 PM   #4
oot
Member
 
Registered: Dec 2002
Distribution: Slackware 12.0
Posts: 240

Rep: Reputation: 30
Two things come to mind here:

1. You may not be installing these programs correctly. After you have compiled them, did you run "make install" to copy them to their proper locations, or are you running them in the same directory you compiled them in?

2. If all you really need to do is change the permissions, the command "chmod 755 $program" should do it (replace $program with the name (including the full path) of the program you want to run). Run this command as root.

An explanation of option 2 (you don't need to read this unless you want to know how it works):
Chmod is the Linux program for setting file permissions. If you look at a file with ls -l, you can see what its permissions are set at. For example:
root@boxofrain:~# ls -l testfile
-rw-r--r-- 1 root wheel 0 Apr 11 20:00 testfile
What you're interested in is the thing with all of the dashes in it. The first dash tells you what you are looking at, such as a file or a system device. You can usually ignore this. The next three characters "rw-" give the permissions the file's OWNER (root, in this case) has on the file. The first character in that group will either be an r or a dash, with an r meaning the owner has read permission and a dash meaning the owner does not have read permission. The next character will be either a w (has write permission) or a - (does not have write permission). The last character in this group of three will be either an x (can execute the file as if it were a program) or a - (no execute permission). So, in the example above, the file's owner, root, can read and write the file, but not run it as a program. The next group of three characters after root's permissions indicates the permissions member's of root's group (in this case, sys, as shown above) have on the file. It uses the same system as described above, so members of the "sys" group have read permission, but can't write to or execute the file. The last group of three indicates the permissions everyone else (users who aren't root and aren't in the sys group) have on the file, again, using the same rwx system. So they can also read, but not write or execute.

With chmod, you can either set the permissions by letters (u = owner, g = owner's group, o = other users, + = add permissions - = remove permissions, r = read w = write x = execute) or by numbers. Some examples with letters
"chmod u+x testfile" = "Give the testfile's owner permission to execute the file"
"chmod ug+rw testfile" "Give the testfile's owner, and all members of the owner's group, permission to read and write to the file"
"chmod o-rwx testfile" = "Don't give users who are not testfile's owner or members of the owner's group permission to read write or execute the file, and take away these permissions on the file if they already have them"
"chmod g-w testfile" = "Don't give members of the owner's group permission to write to testfile, and take away the permission if they already have it"

Chmod can also be used with numbers, as I did above giving you the number 755. Each digit in the number corresponds to one group of three from the output of ls -R above, so the first digit is for the file's owner, the second is for the file's owner's group, and the third is for all other users. To calculate the value of each digit, start with 0, add 4 if the user should have read permission, add 2 if the user should have write permission, and add 1 if the user should be allowed to execute the file. For example, since we want the file's owner to be able to read, write, and execute the file, 4+2+1=7, so the first digit is 7. We want the file's owner's group to be able to read and execute the file, but not write to it, so 4+1=5, and the second digit is 5. We want the rest of the users to also be able to read and execute the file without writing, so again, 4+1=5. So our end result is "chmod 755 testfile".

Let's have a look and see if that works:
First, we create a file testfile to test this on:
root@boxofrain:~# touch testfile
Now, we have a look at the permissions on testfile:
root@boxofrain:~# ls -l testfile
-rw-r--r-- 1 root sys 0 Apr 11 20:14 testfile
As you can see, root can read and write to the file, and members of root's group (sys) and all other users on the system can only read it.
Let's try changing the permissions:
root@boxofrain:~# chmod 755 testfile
And have a look to see if it worked:
root@boxofrain:~# ls -l testfile
-rwxr-xr-x 1 root sys 0 Apr 11 20:14 testfile
Yup! It worked! Isn't chmod a wonderful command?
 
Old 04-11-2004, 08:35 PM   #5
imagreg
Member
 
Registered: Mar 2004
Distribution: Slackware 10.0
Posts: 76

Original Poster
Rep: Reputation: 15
Hi oot...

I installed both K3b and gtkam with ./configure --prefix=/usr, make, su, make install

I have installed several packages and am not new to linux and am fairly familiar with chmod.

My problem is that with K3b I can get it running as a user. I can burn mp3's and copy files but I can't copy a cd. I don't have the permission to use the cd as user. I get a message saying that it can't open the device. However, if I run it as root I can burn cd's.

Same with gtkam. I can get it up and running but I can't access my camera as user. I have to log in as root to be able to access my camera and get the photos.

Does this make sense? I have used several other distros and haven't had issues. I have wanted to use Slackware for some time. I really like the distro but I've run into a couple of snags. Thanks for your help.

Greg
 
Old 04-11-2004, 08:58 PM   #6
ringwraith
Senior Member
 
Registered: Sep 2003
Location: Indiana
Distribution: Slackware 15.0
Posts: 1,272

Rep: Reputation: 65
to add yourself to a group, you can edit /etc/group
 
Old 04-11-2004, 09:15 PM   #7
sharpie
Member
 
Registered: Jan 2004
Location: California
Distribution: Slackware 10.1
Posts: 190

Rep: Reputation: 30
You might need to set up sudo. I haven't tried this yet so I can't help, try searching for sudo.
 
Old 04-11-2004, 09:22 PM   #8
oot
Member
 
Registered: Dec 2002
Distribution: Slackware 12.0
Posts: 240

Rep: Reputation: 30
First of all, Imagreg, I apologize if my instructions were too newbified. I didn't mean to be insulting, it's just that with such a wide variety of experience levels here it's sometimes hard to tell what level somebody is at just from a short post. Secondly, I also apologize for misunderstanding your question.

It sounds like your problem is with permissions on the files under /dev that represent your devices. Those are the files to change the permissions on. I don't know what they are on your system, but the CD drive is probably /dev/hd<something> or /dev/sd<something>.

Good luck.
 
Old 04-11-2004, 09:24 PM   #9
oot
Member
 
Registered: Dec 2002
Distribution: Slackware 12.0
Posts: 240

Rep: Reputation: 30
Oh... *smacks forehead*... your CD drive may also be /dev/cdrom*, where * is either nothing or a number.
 
Old 04-28-2004, 09:54 PM   #10
Frank_Drebin
Member
 
Registered: Feb 2004
Location: Atlanta, GA USA
Posts: 232

Rep: Reputation: 30
I can help with the camera

I can help with GTKAM, Gphoto2 permissions. Do the following...

as root type the following

vi /etc/hotplug/usb/usbcam

erase everything in it (back it up if you don't trust me)
and put the following lines in...
(by the way, if there was nothing in the file, just type the following and save it)

if [ "${ACTION}" = "add" ] && [ -f "${DEVICE}" ]
then
chmod a+rwx ${DEVICE}
fi

That should do it. Now, plug your camera in, then turn it on. Hotplug will detect it and look to this file to see what to do with it. Start gtkam or digikam or flphoto and it should work fine as a user now.

Good luck!!
 
Old 04-28-2004, 10:13 PM   #11
little_ball
Member
 
Registered: Oct 2003
Location: teddy bears Land
Distribution: Slackware 10
Posts: 176

Rep: Reputation: 30
it's not saying that you are nebwified is the reason that distros like suse, mandrake, redhat and things like that, that you already had use maybe for several years are different that the way slack manage, those others distros are friendly like, had the supermount activated in the kernel options, had cute graphical configuration methods, have several cute things that does almost every configuration for the user. Let's talk about slack... slackware is not friendly, slack doesn't bring supermount stuff, slack doesn't have cute graphical tools for you configure anything. Put it this way, slack is not a pain, but had is method when you use slack, don't compare it too mandrake or redhat think you are using BSD or Solaris. if you want to configure him you had to work whit commands line and config files manually. to let slack mount and umount the cdrom or floppy drive as a non root user, you could edit sudo, edit /etc/groups or the easy way edit /etc/fstab and add the line user, under the line that points to your cdrom, floppy and probably your usb camera is under there too. i should you a example of my fstab file and now i could mount and umount my devices whit out been root.

/dev/cdrom /mnt/cdrom iso9660 noauto,user,owner,ro 0 0
/dev/fd0 /mnt/floppy auto noauto,owner,user 0 0

so you see, i could open cdrom and floppy whit out being root. Make your choice, edit the conf files, and be happy =)
 
Old 04-28-2004, 11:41 PM   #12
imagreg
Member
 
Registered: Mar 2004
Distribution: Slackware 10.0
Posts: 76

Original Poster
Rep: Reputation: 15
Thanks for the suggestion little_ball but I have already done these. I can open the cd and floppy just fine as user. Thats not the problem. My problem is that I can't copy a music cd as user for some reason. I can burn files and iso's but I can't copy a music cd or rip songs from a cd. I have tried just about everything.

This is the Debugging Output that I get:

K3b Version: 0.11.2
KDE Version: 3.2.1
QT Version: 3.3.1

Last edited by imagreg; 04-29-2004 at 12:29 AM.
 
Old 04-29-2004, 12:51 AM   #13
imagreg
Member
 
Registered: Mar 2004
Distribution: Slackware 10.0
Posts: 76

Original Poster
Rep: Reputation: 15
Hi Frank...I didn't have the file usbcam so I tried what you said and used vi to create the file under /etc/hotplug/usb/usbcam

I added:

if [ "${ACTION}" = "add" ] && [ -f "${DEVICE}" ]
then
chmod a+rwx ${DEVICE}
fi

Still no go :-( oh well...I appreciate the suggestion
 
Old 04-29-2004, 03:55 AM   #14
Marsanghas
Member
 
Registered: Sep 2003
Location: Spijkenisse, Netherlands
Posts: 119

Rep: Reputation: 15
Quote:
Originally posted by imagreg
Thanks for the suggestion little_ball but I have already done these. I can open the cd and floppy just fine as user. Thats not the problem. My problem is that I can't copy a music cd as user for some reason. I can burn files and iso's but I can't copy a music cd or rip songs from a cd. I have tried just about everything.

Try adding yourself to the 'disk' group... maybe it'll work. If it doesn't... then there is one other thing... if you start k3b as root (you'll probably be able to rip it as root) from an xterm you would probable see something like

Checking /dev/cdrom for cdrom...
Testing /dev/cdrom for cooked ioctl() interface
/dev/scd0 is not a cooked ioctl CDROM.
Testing /dev/cdrom for SCSI interface
generic device: /dev/sg0
ioctl device: /dev/scd0

change the permissions on that sg0 device (chmod 666 /dev/sg0) and you'll be able to rip from k3b as a normal user.

Last edited by Marsanghas; 04-29-2004 at 04:15 AM.
 
Old 04-29-2004, 01:48 PM   #15
imagreg
Member
 
Registered: Mar 2004
Distribution: Slackware 10.0
Posts: 76

Original Poster
Rep: Reputation: 15
I think the cdrom is fine I think what I need are the correct permissions for cdrecord. I think this is where my problem lies. I can burn music cds fine under root but can't as user so I am thinking this is the problem. I tried chmod 666 cdrecord but this didn't work. Any suggestions? Thanks.
 
  


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
permission ... permissions .... permissions alaios Linux - General 1 05-31-2005 04:16 AM
Permissions jymmi Linux - Newbie 3 04-14-2005 11:43 PM
Permissions help reddog64 Linux - Newbie 1 04-22-2004 05:23 PM
getting a directory's permissions and creating a new one with the same permissions newbie1000101 Programming 1 04-10-2004 12:52 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

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