PDA

View Full Version : Make new user with same configs as current user?



SunnyB
03-05-2004, 07:42 PM
I have set up the knoppix user just as I want it.
I now want to make a new user (SunnyB) with
the same configuration as the knoppix user.

Can I copy the entire /home/knoppix directory to another
directory "SunnyB" under /home/sunnyb.

If this can be done can I then copy the config file
knoppix.sh to sunnyb.sh and get away with it.

What's the easiest way.

bamarob
03-05-2004, 08:52 PM
Create the new user from kuser, adduser, useradd, whatever...
If the tool you used to create the new user created a home directory, remove it with 'rm -rf /home/[new_user]'
Copy the knoppix home folder for the new user 'cp -R /home/knoppix /home/[new_user]'
change ownership of everything in the new users home with 'chown -R [new_user] /home/[new_user]

That ought to work...

BR

Cuddles
03-06-2004, 02:39 PM
SunnyB, I did the exact same thing, only about two months ago...

I would suggest doing what bamarob suggests...

I would just add one more thing, this is what I am "still" catching "fall-out" from...

Considering that you are copying "everything" from a specific user, and making it another user, take note of any "weird" messages, or errors, in the "new users" login. "Weird" here is defined as, getting messages that "you do not have permission to do 'xxxxxxx'" stuff.

Some of these "copied" configuration files contain file locations for temp folders, etc... (and since you copied them from "another" user, these locations will still point back to the "copied from" users locations. I got nabbed by a audio ripping program, like K3b, which users temp folders, it kept yelling about the TEMP FOLDER not having rights to do anything. After "looking" at the configs for days, I _FINALLY_ noticed the folder was in the /home/knoppix/tmp location - DUH :!:

Its an easy fix, but, can be frustrating if you don't remember that you "cloned" your users settings, when something doesn't work like it did when you ran it just fine as 'knoppix'

Just some "heads up" information,
Cuddles

SunnyB
03-07-2004, 04:48 AM
I did as bamarob said then I chown'd the entire directory.
Everything went as expected. I then spent four hours editing every
file in that new directory and changed every reference to /home/knoppix to /home/sunnyb.

The really frustrating part was after I got it all changed and
ready, I could not switch users in order to save the configs for the
new user. Although I had set the permissions on the new user
to root, sudo, sunnyb and every other high permission level, I could not saveconfig the new user. Each sudo got an error, "sunnyb does not have sudoers permission, This will be repported.". WTF was that anyway. I checked and rechecked. Nothing helped.

I eventually logged out in hopes of relogging while the new user
was intact but no joy. It rebooted instead, effectively wiping the
whole days work. What a PITA.

Probably won't be messing with it for a while. Anything that difficult
has to be profitable, otherwise it better be fun. It wasn't.

It's back to my Debian box for a while.

Thanks anyway for the help.

SunnyB
03-09-2004, 02:02 PM
Well I finally got this to work. In case anyone is trying to do the same thing.
The main problem is that although I could make a new user and set the
permissions to root, sudo, etc. the Knoppix menu did no recognize any user
not named knoppix. So when I tried to save configs through that menu it just
hung or failed.
1. I logged in as knoppix 2 myconfig. blah blah
This way I started the session through KDM which gave me the option to
logout and log back in without killing the session or rebooting.
2. I copied the entire /home/knoppix dir to /home/sunnyb recursed.
cp -R /home/knoppix /home/sunnyb just as Bamarob said.
3. I chown'd the entire dir to sunnyb
chown -R sunnyb /home/sunnyb
4. I logged out as knoppix and logged back in as sunnyb.
This is where the Knoppix menu did not let me use the save configs.
I had to GKsu the saveconfig command and mkpersistenthome command
to save the configs and a persistent home dir.
5. Now I was able to log in with the knoppix 2 myconfig= blah blah
command and at the root prompt I used KDM which gives me the option
of logging in as knoppix, sunnyb or root.

This may be as close as I can get without remastering / making a live CD
from the session but it works and now my local network recognizes
the machine because I am logged in as sunnyb. Now I just have to change
the paths in all of the shell scrips again and it will be OK.

Thanks all.