This are some commonly asked linux questions that I've answered before. I figured it would be useful to have them listed on the web.
Gary, So I am using Linux and managed to install a few packages myself and even mount my drives. But my soundcard does not work unless I am logged in as root. It flashes something about permission denied when I login under my user account. Any suggestions on how to resolve this problem? -Kevin
There is an very well desinged way to solve this, in fact. All accessing of hardware by programs in linux happens by programs reading or writing to special files call "device nodes". All the device nodes are stored in the /dev/ directory. For example, the mixer for your sound card is a file called /dev/mixer. If you do an ls -l on /dev/mixer, you will see something like: gsteele@atlas:/dev$ ls -l /dev/mixer crw-rw---- 1 root audio 14, 0 Aug 8 2001 /dev/mixer What you can notice is that it is owned by root, with a group "audio", and the permissions are owner RW, group RW. To be able to use the mixer, you have to be part of the group "audio". You can check what groups you are part of by running a command called "groups": gsteele@atlas:/dev$ groups gsteele disk dialout cdrom floppy audio You can see that on my machine, the user gsteele has permissions to read and write to devices marked as groups disk (hard disks, /dev/hd*), dialout (serial ports, /dev/ttyS*), cdrom (scsi cdroms, /dev/scd*), floppy (floppy drives, /dev/fd*), and audio (audio devices, /dev/mixer, /dev/dsp, etc). As root, you can add a user to a group using the "adduser" command: gsteele@atlas:/dev$ adduser -h adduser [--home DIR] [--shell SHELL] [--no-create-home] [--uid ID] [--firstuid ID] [--lastuid ID] [--gecos GECOS] [--ingroup GROUP | --gid ID] [--disabled-password] [--disabled-login] user Add a normal user adduser --system [--home DIR] [--shell SHELL] [--no-create-home] [--uid ID] [--gecos GECOS] [--group | --ingroup GROUP | --gid ID] [--disabled-password] [--disabled-login] user Add a system user adduser --group [--gid ID] group addgroup [--gid ID] group Add a system group adduser user group Add an existing user to an existing group For example, to add yourself to the audio group, you could run the command "adduser kturner audio" as root. I hope this has been enlightening :). You coming to the party tonight? I'm gonna meet susan at central at 9:00. Cheers, Gary.
Squash at 7 tomorrow is good. If you have time, I have a Linux question... I have my windows drives mounted and the only way I can write to them is if I am root. So I tried to remedy this by changing the group they belong to and adding myself to that group. I created a group called windrive and assigned that as the group ID on the drive. When I do ls -l, I get this: kturner@mems:/mnt$ ls -l total 24 drwxr-xr-x 18 root windrive 8192 Dec 31 1969 c drwxr-xr-x 22 root windrive 16384 Dec 31 1969 data Which as I understand it, means root can read, write and execute, but the group windrive can only read and exeute. So I logged in as root and tried chmod g+w ./c which I thought should give the group permission to write on c. It does not give errors, but it also doesn't change the permissions. When I do ls -l again I still get the same permisssions mems:/mnt# ls -l total 24 drwxr-xr-x 18 root windrive 8192 Dec 31 1969 c drwxr-xr-x 22 root windrive 16384 Dec 31 1969 data Any suggestions? -Kevin
Yeah, this is a common problem. It is related to the fact that FAT filesystems really don't have permissions. The way that linux handles this is that when you mount a FAT drive, all the files are given the _same_ file permissions at mount time. Furthermore, once mounted, these permissions can't be modified. The default permissions that mount will use for FAT partitions is "rwxr-xr-x". To change this, you can add an option "umask=" in the fstab file. For example, on my computer, I use: /dev/hda1 /mnt/c vfat defaults,umask=0000 0 0 The argument to umask is and octal number. To understand what this number means, you have to understand how file permissions actually work in unix. The way file permissions are stored on the disk is as a 9-bit binary number. The best way to show this is with examples. File permission are commonly represented in three ways: rwxr-xr-x - human readable 111101101 - binary number 7 5 5 - 3 octal numbers The last one is the most important. If you read the manpage for chmod, you will notice that you can specify the desired permissions using and octal number. Examples: gsteele@atlas:~$ chmod 0755 foo gsteele@atlas:~$ ls -l foo -rwxr-xr-x 1 gsteele gsteele 1123166 Mar 27 11:42 foo* gsteele@atlas:~$ chmod 0766 foo gsteele@atlas:~$ ls -l foo -rwxrw-rw- 1 gsteele gsteele 1123166 Mar 27 11:42 foo* gsteele@atlas:~$ chmod 0777 foo gsteele@atlas:~$ ls -l foo -rwxrwxrwx 1 gsteele gsteele 1123166 Mar 27 11:42 foo* (Note: the first number is related to "special file permissions". You should always leave this number as 0. You can read about these here: http://www.lns.cornell.edu/public/COMP/info/fileutils/fileutils_3.html#SEC4) Now, umask is like the binary NOT of the file permissions you want. For example: rwxr-xr-x - desired file permissions 111101101 - binary file permissions 000010010 - umask 0 2 2 - octal umask So, for example, in my fstab file, I use umask=0000, so that the permissions on my dos drive are rwxrwxrwx. If you wanted the permissions on the dos drive to be rwxrwxr-x, you would set umask=0002. You can also change the group and the owner of the FAT partition files using the options uid=value,gid=value in the fstab file, where the values are the user id number and group id number. The uid numbers for users are listed in the file /etc/passwd, and the gid numbers are listed in the file /etc/group: in /etc/passwd: gsteele:x:1001:1001:Gary Steele,13-2033,3-4810,:/home/gsteele:/bin/bash | | uid default gid for user gsteele in /etc/group: gsteele:x:1001: | gid for group gsteele This should sort out any problems. Cheers, Gary.
Hi Gary How's things? I've a couple of questions about Linux for you. Is there a Linux equivalent of Windows Media Player, that can play .avi, mpegs etc? Also is it possible to simply update the version of Debian that I'm running or will that lead me to having to play with some of the configuration files? What about the GNome window manager - how can I update this? How is everything going at MIT these days? What have you lot been upto recently? Have fun and keep in touch. All the best Peter
Hi Peter, Not been upto much lately here. I'm gonna go to Conor's beer party tonight, we'll see how that goes :) About playing movies, I'd recommend you try either Xine (there are debian packages) or mplayer. I really like mplayer. There are no packages, but it is pretty easy to compile, and works very well with almost _all_ avi files, as well as any mpeg. You can download it from: http://www.mplayerhq.hu/homepage/ About debian, one thing you could try is "apt-get dist-upgrade". If you have edited you /etc/apt/sources.list file to use "woody" (or "testing" which is the same thing), you can just type "apt-get dist-upgrade" and with any luck, everything will work. Warning: this will replace a hundred or more packages, so there could be problems. If you do have problems, I'd recommend typing "apt-get -f install", and then "apt-get dist-upgrade" again. You can continue doing this until it doesn't have anything left to do. Once you've dist-upgraded, I'd recommend running "tasksel", which will allow you to pick big groups of packages to install from the new distribution. Cheers, Gary.