You are not logged in.

#1 2004-03-25 20:13:29

whol
Member
Registered: 2004-02-04
Posts: 155

Becoming non-root.

Being relatively new to linux, and very new to Arch - I have been doing everything as "root".  This has made it easier for me to set up everything, and learn how things work.  I think I need to make a normal user account now, and switch over to using that (instead of using root).  I installed Alsa, vmware, firefox, xine, xmms, RTCW, Enemy Territory, and lots of other packages - as "root".

To run software as non-root, I think I might need to set up some "groups", like a "sound" group or maybe a "game" group, and give those groups access to the sound card. 

Should I re-install Arch? 
Should I re-install packages as my new user?
Should I create groups for various tasks?
Can I give my "normal" account superuser access? (like on Windows).

I'm not sure what tasks are supposed to be done as root, and which as a user.  I expect everything to stop working once I start using my new account. :-(

For example, I have two big (160GB) data drives that I want to freely read and write to, but I will have to set up some kind of permissions for that (/mnt/data1 and /mnt/data2).

Well, I thought I'd ask to see if anyone had any good tips.  I'll be trying to switch over tonight.

thx!

Offline

#2 2004-03-25 20:21:13

normnmiles
Member
From: /US/IL
Registered: 2004-03-20
Posts: 64

Re: Becoming non-root.

Here check out the documenation on creating a new user.
http://www.archlinux.org/docs/en/guide/ … tml#SEC3.3

Next, you will want to get familar with the chown, chgrp, chmod commands as they will allow you to change the permissions on the data you have already created.

Also take a look at sudo.  It allows you to run programs at root like access with your non-root accounts.

You should be able to run your programs as you do now.  Just copy some of the configuration files from /root to your new user's home under /home/username

sorry this is so outlined and brief.  But i have to attend a call now.
hth

Offline

#3 2004-03-25 20:57:04

Win
Member
Registered: 2004-03-04
Posts: 155

Re: Becoming non-root.

Hi whol.

First, follow normnmiles suggestions, but ome of these are probably mysterious to you, I would suspect.

1. Add a non-root user.  Use the 'useradd' command.  Type 'useradd --help' to get a list of the relevant options:

[wcarus@blackadder]$ sudo useradd --help
useradd: invalid option -- -
Usage: useradd [-u uid [-o]] [-g group] [-G group,...]
               [-d home] [-s shell] [-c comment] [-m [-k template]]
               [-f inactive] [-e expire]
       useradd -D [-g group] [-b base] [-s shell]
               [-f inactive] [-e expire]

You'll probably do something like the following, as root:

useradd -g users -d /home/your-name -s /bin/bash -m your-name
passwd your-name

2. Make appropriate changes to /etc/group.  I find that editing the /etc/group file is the easiest approach.  This must be done as root (or using 'sudo' (more below)).

nano /etc/group

You should probably set up the following:

users::100:your-name
audio::15:your-name

and possibly the following, if you use slocate and have a distinct group for your cdrom burners:

slocate:x:21:your-name
cdrom::17:your-name

IMPORTANT: The numbers (except for slocate) will have to be set to match your group file. Don't just copy my numbers blindly; make sure they are unique.  Some users take numbers above 100 for user-added groups (that aren't already added automatically by pacman installation).

3. Add sudo, as root:

pacman -S sudo
visudo

Note: visudo is run using vim, so you'll need to know a few vi commands.

Insert the following line, if you want a really easy, but somewhat dangerous sudo setup:

your-name     ALL=(ALL) NOPASSWD: ALL

You'll then be able to run anything as your non-root user by prefixing it with sudo (and it won't ask for a password).  This is not particularly safe, but it's a bit better than running as root.

If you want to use a password (which is asked only the first time or only after a long delay between uses of sudo):

your-name     ALL=(ALL) ALL

This really should is the preferred general setup.

For example, you can now edit files that can normally only be accessed as root:

sudo nano /etc/rc.conf
sudo nano /etc/lilo.conf

4. Log off root and log into your account.  Edit .xinitrc to load the appropriate graphical environment.

nano .xinitrc

To set up KDE, .xinitrc should look like:

#!/bin/sh

#
# ~/.xinitrc
#
# Executed by startx (run your window manager from here)
#

# exec wmaker
exec startkde
# exec icewm
# exec blackbox
# exec fluxbox

Comment the graphical environments as appropriate to your setup.

You should then be all set.

Good luck,

Win

Offline

#4 2004-03-25 21:33:46

andy
Member
From: Germany
Registered: 2002-10-11
Posts: 374

Re: Becoming non-root.

OK, I'll try to keep this short (and therefore simple) :

- you can't break anything if you are a user ;-) ... so : <b>Just Try ! :-) </b>

- don't worry about groups just yet. Just see what works and what does not.

- installing pacakges as root is usually the way you do it anyways !
Remember, Unix is a multi-user system since its dawn. It is designed so that one user (root) manages everything, and all the users take advantage of it.

Offline

#5 2004-03-27 11:00:51

whol
Member
Registered: 2004-02-04
Posts: 155

Re: Becoming non-root.

Ok, I follows Win's instructions, and set up an account called "b".  I added "b" to the wheel group, and then used visudo to let the wheel group run root commands with a password (I dont mind typing in the pw).

So then I used scp to copy a tar'd vmware virtual machine from my /root directory to my /home/b directory, untarred it, and ran vmware.

When vmware began to start up the virutal machine, I got two permission errors.  I lacked permissions on "/dev/mixer" and "/dev/dsp".

I know there are several ways to solve this problem, but I wasnt sure which was best.  I thinkI can:

make a "sound" or "audio" group, add "b" to it, then give that groups some permissions to those devices (somehow).  Or I could maybe mayke everyone be able to use those devices.  Or I could say "b" was the owner of those devices. 

I currently do not have either a "audio" or "sound" group.  I am running fluxbox with ALSA sound. Though I switch to xfce4  or gnome later.

any suggestions?

thx!

Offline

Board footer

Powered by FluxBB