Multiuser (or at least dual user :) ) puppy linux

A home for all kinds of Puppy related projects
Message
Author
User avatar
dejan555
Posts: 2798
Joined: Sun 30 Nov 2008, 11:57
Location: Montenegro
Contact:

Multiuser (or at least dual user :) ) puppy linux

#1 Post by dejan555 »

Lots of users are moaning about puppy not being multiuser, well me personally don't need that but I was interested to see if I can hack it to do that and maybe learn little more about puppy that way. I'll tell you what I've done so far and how.

WARNING! Do NOT try to do this if you're not sure what you're doing, I'm not responsable for any system failure or data loss you may cause! :P I recommend making some frugal install or create another pup_save for trying this

OK, so like I said, there's another user in puppy already and it's called spot (that folder spot in your /root dir is spot's home dir. But puppy logs in into root account on every boot automatically. So here's a first step:

Edit your /etc/inittab
edit line which says:
tty1::respawn:/sbin/getty -n -l /bin/autologinroot 38400 tty1
remove -n -l /bin/autologinroot
so now you have left this in that line:
tty1::respawn:/sbin/getty 38400 tty1
Now when you reboot system it will ask you for username and pass
Default pass for root is woofwoof

Next: Create password for spot (and maybe change root password?)
open terminal, then type:

Code: Select all

passwd root

to change password for root

Code: Select all

passwd spot
to create password for spot

OK, so now we have two users with passwords and login prompt at bootup

But, we're not nearly finished. Most of scripts for running X read info and stuff from root's home dir so what do I do next?

Copy all files from root's dir (except spot dir itself, including hidden dirs) into spot dir, then I change owner of those files to spot:

Code: Select all

chown -R spot /root/spot
Next: hack xwin to load xinitrc from user's home dir instead from root's
Open /usr/X11/bin/xwin then replace where it says /root/.xinitrc to ~/.xinitrc (use Search -> Replace -> Replace All in Document in Geany)

Also X starts apps and scripts from /root/Startup and I don't know where is the script that loads them, so I make a workaround for that:
Make directories /root/XStartup and /root/spot/XStartup then place a script in /root/Startup to start apps from that dirs at X startup:

Code: Select all

#!/bin/sh
cd ~/XStartup/
for i in *; do ./$i; done
^Place this script in /root/Startup and all other startup scripts place in /root/XStartup and /root/spot/XStartup

OK, so what you will be able to do with this changes so far using spot as user?
You'll be able to start X, run most of apps and have some settings customized?
What you won't be able to do?
You can't mount anything, and you can't start console (it keeps dissapearing, I thought this is because of rxvt's hold option, but sakura and xterm didn't work either, maybe we could throw in sudo command or something?)

Here are some more issues that I noticed:
--Files /tmp/xerrs.log | /etc/.XLOADED | /etc/windowmanger | /dev/zero
have read-only permissions for spot (maybe chmod here?)
--If you change icons they will be changed on both accounts
--You can't change wallpaper as spot, setter writes changes to root's PuppyPin file?

You can change icewm theme though :P

OK, enough from me, please test this and find out some more hacks we can do.

Cheers, Dejan 8)
puppy.b0x.me stuff mirrored [url=https://drive.google.com/open?id=0B_Mb589v0iCXNnhSZWRwd3R2UWs]HERE[/url] or [url=http://archive.org/details/Puppy_Linux_puppy.b0x.me_mirror]HERE[/url]

User avatar
Pizzasgood
Posts: 6183
Joined: Wed 04 May 2005, 20:28
Location: Knoxville, TN, USA

#2 Post by Pizzasgood »

The /root/Startup code is in /usr/sbin/delayedrun

The deskop icons are part of Rox, which is started in ~/.xinitrc. Tell it to use ~/Choices/ROX-Filer/PuppyPin rather than /root/Choices/ROX-Filer/PuppyPin.

I found that same terminal bug a number of months ago when I was doing a crude kid-safe setup. I think the problem was a file in /dev. I'll go see if I can find where I posted about it before so you can fix that.


If you're intending to take this all the way, you'll want to do some quick studying on "grep". (If you aren't that serious about this, no worries - I am, and intend to start working on a proper setup this summer. Any help is welcome - and you're VERY welcome to save me a lot of time and finish before I get started ;)) Grep lets you find text within files. For example, to find the /root/Startup code, I had only to run this command:

Code: Select all

grep -R '/root/Startup' /usr/sbin /etc/
The -R tells it to be recursive. The '/root/Startup' is the string it searches for. The /usr/sbin and /etc are directories I want it to look through. I could have given it /, but then it would have searched everything in /mnt, which is quite a lot. Even searching all of /usr can be slow. So I try to narrow it down to places I think are likely first, and widen the search as needed until I find it.

I could also have added the -l flag (that's a lowercase L) to have it only output the filenames that have the text, instead of the filename and the text. That's useful if there are many matches within a single file, because it would stop it from spamming your terminal.

Use grep --help for more info.


Sed is also handy, but you have to be careful with it. It lets you find-and-replace text from a script. You could theoretically do this:

Code: Select all

sed -i 's|/root/|~/|g' /some/file/name
to replace all instances of /root/ with ~/ in a the file /some/file/name. You could combine it with a find command like this:

Code: Select all

find / -mount -type f -exec sed -i 's|/root/|~/|g' "{}" \;
To replace every instance of /root/ with ~/ throughout the drive (it won't look at mounted filesystems). But that could be dangerous. Some things might actually need to use /root/ specifically. And, it wouldn't only affect scripts - it would affect any file with that text in it, binary files included. You'd probably want to somehow filter out the non-text files. All in all, it would be best to look at each file manually to make sure they're all safe to change.

Also, I have a vague memory that in some cases, it may be better to use $HOME/ rather than ~/. I think it was because the ~/ isn't as portable across different shells?
[size=75]Between depriving a man of one hour from his life and depriving him of his life there exists only a difference of degree. --Muad'Dib[/size]
[img]http://www.browserloadofcoolness.com/sig.png[/img]

User avatar
dejan555
Posts: 2798
Joined: Sun 30 Nov 2008, 11:57
Location: Montenegro
Contact:

#3 Post by dejan555 »

Pizzasgood wrote:The /root/Startup code is in /usr/sbin/delayedrun
Thanks
Pizzasgood wrote: Tell it to use ~/Choices/ROX-Filer/PuppyPin rather than /root/Choices/ROX-Filer/PuppyPin.
I did, forgot to mention that, that saves icons and their positions, but not icon theme! I think actuall icons are copied from their theme directories into /usr/local/lib/X11/pixmaps/ and rox's PuppyPin saves only icons names that pinboard loads from that dir, so if current icons theme is "Stardust" all icons from /usr/local/lib/X11/themes/Stardust will be copied in /usr/local/lib/X11/pixmaps

And for terminal, it might be this /dev/zero permission cause it says it cannot open it when starting X?

Also we need to hack scripts for changing themes, and also see if /etc/windowmanager is also called from xinitrc and maybe put that to save selected wm into ~/.etc/windowmanager ?

I'm familiar a bit with all those commands, just couple a days a go found good tutorial for sed, I don't know if I'll push this 'till the end, but I'm glad we can help each other. :)
puppy.b0x.me stuff mirrored [url=https://drive.google.com/open?id=0B_Mb589v0iCXNnhSZWRwd3R2UWs]HERE[/url] or [url=http://archive.org/details/Puppy_Linux_puppy.b0x.me_mirror]HERE[/url]

User avatar
dejan555
Posts: 2798
Joined: Sun 30 Nov 2008, 11:57
Location: Montenegro
Contact:

#4 Post by dejan555 »

Pizzasgood wrote: Also, I have a vague memory that in some cases, it may be better to use $HOME/ rather than ~/. I think it was because the ~/ isn't as portable across different shells?
Well, I noticed this variable when looking at wallpaper script, but for some reason it still loads wallpaper from root's settings (maybe it saves to PuppyPin but reads from /root's PuppyPin when refreshing desktop? Or it's some kind of permission problem too...
puppy.b0x.me stuff mirrored [url=https://drive.google.com/open?id=0B_Mb589v0iCXNnhSZWRwd3R2UWs]HERE[/url] or [url=http://archive.org/details/Puppy_Linux_puppy.b0x.me_mirror]HERE[/url]

User avatar
dejan555
Posts: 2798
Joined: Sun 30 Nov 2008, 11:57
Location: Montenegro
Contact:

#5 Post by dejan555 »

Hey, I have another question u might know. /etc/passwd saves info about user accounts, but does it saves passwords in same file? If I did remaster I'd have to know that cause /etc will be in a pristine state.
puppy.b0x.me stuff mirrored [url=https://drive.google.com/open?id=0B_Mb589v0iCXNnhSZWRwd3R2UWs]HERE[/url] or [url=http://archive.org/details/Puppy_Linux_puppy.b0x.me_mirror]HERE[/url]

User avatar
Pizzasgood
Posts: 6183
Joined: Wed 04 May 2005, 20:28
Location: Knoxville, TN, USA

#6 Post by Pizzasgood »

Passwords typically go into /etc/shadow. Group info in /etc/group. User info in /etc/passwd.

Passwords were originally in passwd, but that file is world readable (and needs to be, from what I understand), so they were eventually moved into a separate file that could be made readable only by root (thus the name 'shadow').

I found the thing with the terminal. I haven't re-tested it to verify, but it looks like the problem was the permissions on /dev/ptmx

Code: Select all

addgroup spot tty
chgrp tty /dev/ptmx
chmod g+w /dev/ptmx
That adds "spot" to the tty group, and sets /dev/ptmx to belong to the tty group. It also sets it group-writable. So any user in the tty group can access it. (IIRC /dev/ptmx is a psuedo tty, and used by terminal emulators (a real tty is used by the actual commandline)).

Not sure whether that's the best way to do it. Much better than making it globally writable at least.

Good night.
[size=75]Between depriving a man of one hour from his life and depriving him of his life there exists only a difference of degree. --Muad'Dib[/size]
[img]http://www.browserloadofcoolness.com/sig.png[/img]

John Doe
Posts: 1681
Joined: Mon 01 Aug 2005, 04:46
Location: Michigan, US

#7 Post by John Doe »

dejan555 wrote:Hey, I have another question u might know. /etc/passwd saves info about user accounts, but does it saves passwords in same file? If I did remaster I'd have to know that cause /etc will be in a pristine state.
This link should help you out with that:

http://tldp.org/LDP/lame/LAME/linux-adm ... rmats.html

up one level gives a boat load of additional info:

http://tldp.org/LDP/lame/LAME/linux-admin-made-easy/

User avatar
dejan555
Posts: 2798
Joined: Sun 30 Nov 2008, 11:57
Location: Montenegro
Contact:

#8 Post by dejan555 »

If I add another user I can set it to belong to group spot so it has same permissions? I can set /dev/zero to spot's group same way as for ptx?
puppy.b0x.me stuff mirrored [url=https://drive.google.com/open?id=0B_Mb589v0iCXNnhSZWRwd3R2UWs]HERE[/url] or [url=http://archive.org/details/Puppy_Linux_puppy.b0x.me_mirror]HERE[/url]

User avatar
dejan555
Posts: 2798
Joined: Sun 30 Nov 2008, 11:57
Location: Montenegro
Contact:

#9 Post by dejan555 »

OK, I'm typing this from spot's account, did manage to fix console with Pizzasgoods tip, also added /dev/zero to tty group. When I type su in console it says :
must be suid to work properly
I tried su root and su -p but no effect, so if you start console you won't be able to do any root stuff like mounting devices and similar. Tried wallpaper setter again, it did change selected image at first, but when it started syncing wallpaper with pwidgets it returned to previous image, so it must be something within that pwidgets sync script.
puppy.b0x.me stuff mirrored [url=https://drive.google.com/open?id=0B_Mb589v0iCXNnhSZWRwd3R2UWs]HERE[/url] or [url=http://archive.org/details/Puppy_Linux_puppy.b0x.me_mirror]HERE[/url]

User avatar
dejan555
Posts: 2798
Joined: Sun 30 Nov 2008, 11:57
Location: Montenegro
Contact:

#10 Post by dejan555 »

Choosing windowmanager:

~/.etc is a link to /etc, so I placed windowmanager file in ~/Choices and edited line in .xinitrc to read wm info from there:

CURRENTWM="`cat ~/Choices/windowmanager`"

and also change line in /usr/X11/bin/xwin:

if [ $1 ];then
echo -n "$1" > ~/Choices/windowmanager
#note, ~/.xinitrc uses this file.
fi
puppy.b0x.me stuff mirrored [url=https://drive.google.com/open?id=0B_Mb589v0iCXNnhSZWRwd3R2UWs]HERE[/url] or [url=http://archive.org/details/Puppy_Linux_puppy.b0x.me_mirror]HERE[/url]

User avatar
Pizzasgood
Posts: 6183
Joined: Wed 04 May 2005, 20:28
Location: Knoxville, TN, USA

#11 Post by Pizzasgood »

You can set the setuid bit on su by running this:

Code: Select all

chmod +s /bin/su
However, in Puppy 'su' is just a symlink to /bin/busybox, which handles a bunch of other basic commands. So setting the setuid bit on su would set it for all of those basic programs. I don't know if that's bad or not.
[size=75]Between depriving a man of one hour from his life and depriving him of his life there exists only a difference of degree. --Muad'Dib[/size]
[img]http://www.browserloadofcoolness.com/sig.png[/img]

User avatar
dejan555
Posts: 2798
Joined: Sun 30 Nov 2008, 11:57
Location: Montenegro
Contact:

#12 Post by dejan555 »

Hmmm, but spot still wouldn't be able to execute root commands b4 changing to root and entering root's pass?

Anyway, that's most of main setup for spot, I think now we have left only changing that scripts for customizing wallpaper, icons, etc. And I'm not sure I can do that.
puppy.b0x.me stuff mirrored [url=https://drive.google.com/open?id=0B_Mb589v0iCXNnhSZWRwd3R2UWs]HERE[/url] or [url=http://archive.org/details/Puppy_Linux_puppy.b0x.me_mirror]HERE[/url]

User avatar
dejan555
Posts: 2798
Joined: Sun 30 Nov 2008, 11:57
Location: Montenegro
Contact:

#13 Post by dejan555 »

OK, suid worked, but remember how we added those /dev/ptmx and /dev/zero to tty group and made them group writable? I think it didn't remember those settings, when I logged in rxvt disappeared again so I had to do it again? :(
puppy.b0x.me stuff mirrored [url=https://drive.google.com/open?id=0B_Mb589v0iCXNnhSZWRwd3R2UWs]HERE[/url] or [url=http://archive.org/details/Puppy_Linux_puppy.b0x.me_mirror]HERE[/url]

User avatar
Pizzasgood
Posts: 6183
Joined: Wed 04 May 2005, 20:28
Location: Knoxville, TN, USA

#14 Post by Pizzasgood »

It didn't remember them across boots, or it didn't remember them across remasters? The remaster script might not include changes you make to /dev, so you'd have to manually correct them at the part where the script pauses and lets you manually adjust things in /tmp before it finishes building.
[size=75]Between depriving a man of one hour from his life and depriving him of his life there exists only a difference of degree. --Muad'Dib[/size]
[img]http://www.browserloadofcoolness.com/sig.png[/img]

User avatar
dejan555
Posts: 2798
Joined: Sun 30 Nov 2008, 11:57
Location: Montenegro
Contact:

#15 Post by dejan555 »

It didn't remember them beetween boots, haven't try remastering still. Or maybe when I logged in as root it somehow reset permissions. :?:
puppy.b0x.me stuff mirrored [url=https://drive.google.com/open?id=0B_Mb589v0iCXNnhSZWRwd3R2UWs]HERE[/url] or [url=http://archive.org/details/Puppy_Linux_puppy.b0x.me_mirror]HERE[/url]

User avatar
Pizzasgood
Posts: 6183
Joined: Wed 04 May 2005, 20:28
Location: Knoxville, TN, USA

#16 Post by Pizzasgood »

Sorry, been really busy lately. Finished my final final on Friday, moved out on Saturday, and now I'm living out of a suitcase at my grandma's for a couple days. I intend to start working for real on multiuser within a week or so, once I get done traveling and settle in.

My suspicion is that the change in permissions was due to udev. That's just a very slightly educated guess.
[size=75]Between depriving a man of one hour from his life and depriving him of his life there exists only a difference of degree. --Muad'Dib[/size]
[img]http://www.browserloadofcoolness.com/sig.png[/img]

User avatar
dejan555
Posts: 2798
Joined: Sun 30 Nov 2008, 11:57
Location: Montenegro
Contact:

#17 Post by dejan555 »

Dr_Willis from #puppylinux chat said that /dev is generated on every boot by fly, so we need to set permissions for those dev files somewhere in rc maybe (rc.local, rc.sysinit) ?
puppy.b0x.me stuff mirrored [url=https://drive.google.com/open?id=0B_Mb589v0iCXNnhSZWRwd3R2UWs]HERE[/url] or [url=http://archive.org/details/Puppy_Linux_puppy.b0x.me_mirror]HERE[/url]

User avatar
Pizzasgood
Posts: 6183
Joined: Wed 04 May 2005, 20:28
Location: Knoxville, TN, USA

#18 Post by Pizzasgood »

/etc/rc.sysinit

Unless there is a file that specifies how /dev should be created each boot, in which case it would be best to use that.
[size=75]Between depriving a man of one hour from his life and depriving him of his life there exists only a difference of degree. --Muad'Dib[/size]
[img]http://www.browserloadofcoolness.com/sig.png[/img]

User avatar
Pizzasgood
Posts: 6183
Joined: Wed 04 May 2005, 20:28
Location: Knoxville, TN, USA

#19 Post by Pizzasgood »

This project is not dead yet!

I wound up getting delayed and not being able to start working on it when I intended to. Then shortly after I did get started, I had some technical difficulties with my laptop. I salvaged all the data, but my laptop has such a small harddrive that I decided to just not bother doing any more until I got back from break and could use my real computer. I got back last weekend. So far I've restored my multi-user work and done a little more. I've implemented most of the stuff in this thread, minus the /dev/ptmx part, which is what I just came to the forum for (couldn't remember which file it was).

I'm also going to add the real 'useradd' program (and related stuff) so that it can make use of /etc/skel/ for creating the user's home directory.


I also didn't do anything about /etc/windowmanager yet. I had forgotten about that. Sticking it in ~/Choices/ sounds like a good idea.


Anyways, just thought I'd mention I hadn't given up or anything. I'd better get back to work. :)
[size=75]Between depriving a man of one hour from his life and depriving him of his life there exists only a difference of degree. --Muad'Dib[/size]
[img]http://www.browserloadofcoolness.com/sig.png[/img]

User avatar
dejan555
Posts: 2798
Joined: Sun 30 Nov 2008, 11:57
Location: Montenegro
Contact:

#20 Post by dejan555 »

Good to know :)
puppy.b0x.me stuff mirrored [url=https://drive.google.com/open?id=0B_Mb589v0iCXNnhSZWRwd3R2UWs]HERE[/url] or [url=http://archive.org/details/Puppy_Linux_puppy.b0x.me_mirror]HERE[/url]

Post Reply