LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   how to assign oneself to a group to get access to a file (https://www.linuxquestions.org/questions/linux-newbie-8/how-to-assign-oneself-to-a-group-to-get-access-to-a-file-752705/)

chadwick 09-04-2009 12:36 PM

how to assign oneself to a group to get access to a file
 
I'm on a regular Fedora 9 desktop computer with an ext3fs filesystem.

I'm trying to give myself access to /dev/ttyS0. This is because I'm developing code that uses a serial port. While I'm developing this code I don't want to be continually working as super user. I have the following information about /dev/ttyS0:

Code:

[freddy@localhost ~]$ ls -lh /dev/ttyS0
crw-rw---- 1 root uucp 4, 64 2009-09-04 12:27 /dev/ttyS0

So as root I added myself (username freddy) to the group uucp. This is just temporary, for while I work on this code and try different stuff as user freddy. Once the code is established and I have a single program with a fixed name, I plan to give myself an entry in /etc/sudoers that will allow me to run the finished program. Here's the info on user freddy:

Code:

[freddy@localhost ~]$ id freddy
uid=500(freddy) gid=500(freddy) groups=500(freddy),14(uucp) context=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023
[freddy@localhost ~]$ groups freddy
freddy uucp

The problem then is that now if I try to use /dev/ttyS0 I can't.

Code:

[freddy@localhost ~]$ echo "hello" > /dev/ttyS0
bash: /dev/ttyS0: Permission denied
[freddy@localhost ~]$ cat /dev/ttyS0
cat: /dev/ttyS0: Permission denied

I thought that if I was a member of group uucp which is associated with /dev/ttyS0 that I would be given rw access to /dev/ttyS0. What am I missing here?

Also, does anyone know what the c stands for in the ls -l listing?

acid_kewpie 09-04-2009 12:40 PM

c = character device, as opposed to b for block device.

are you running selinux here? I can see the contexts listed for your ID, is that possibly getting in the way? In general though you are in that group, and should be fine, but also note those changes are picked up on a login session starting, so old terminals won't get them.

chadwick 09-04-2009 01:38 PM

Quote:

Originally Posted by acid_kewpie (Post 3669919)
those changes are picked up on a login session starting, so old terminals won't get them.

Thanks. This was the problem. No, I'm not using selinux.


All times are GMT -5. The time now is 02:09 AM.