Puppy Linux Discussion Forum Forum Index Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Sat 01 Nov 2014, 05:06
All times are UTC - 4
 Forum index » Advanced Topics » Puppy Projects
Multiuser (or at least dual user :) ) puppy linux
Moderators: Flash, JohnMurga
Post new topic   Reply to topic View previous topic :: View next topic
Page 1 of 5 [61 Posts]   Goto page: 1, 2, 3, 4, 5 Next
Author Message
dejan555


Joined: 30 Nov 2008
Posts: 2704
Location: Montenegro

PostPosted: Sun 26 Apr 2009, 17:58    Post subject:  Multiuser (or at least dual user :) ) puppy linux  

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! Razz 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:
passwd root

to change password for root
Code:
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:
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:

#!/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 Razz

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

Cheers, Dejan Cool

_________________


Back to top
View user's profile Send private message Visit poster's website MSN Messenger 
Pizzasgood


Joined: 04 May 2005
Posts: 6270
Location: Knoxville, TN, USA

PostPosted: Sun 26 Apr 2009, 18:44    Post subject:  

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 Wink) Grep lets you find text within files. For example, to find the /root/Startup code, I had only to run this command:
Code:
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:
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:
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?

_________________
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

Back to top
View user's profile Send private message Visit poster's website 
dejan555


Joined: 30 Nov 2008
Posts: 2704
Location: Montenegro

PostPosted: Mon 27 Apr 2009, 01:23    Post subject:  

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. Smile

_________________


Back to top
View user's profile Send private message Visit poster's website MSN Messenger 
dejan555


Joined: 30 Nov 2008
Posts: 2704
Location: Montenegro

PostPosted: Mon 27 Apr 2009, 01:30    Post subject:  

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...

_________________


Back to top
View user's profile Send private message Visit poster's website MSN Messenger 
dejan555


Joined: 30 Nov 2008
Posts: 2704
Location: Montenegro

PostPosted: Mon 27 Apr 2009, 01:33    Post subject:  

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.
_________________


Back to top
View user's profile Send private message Visit poster's website MSN Messenger 
Pizzasgood


Joined: 04 May 2005
Posts: 6270
Location: Knoxville, TN, USA

PostPosted: Mon 27 Apr 2009, 01:58    Post subject:  

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:
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.

_________________
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

Back to top
View user's profile Send private message Visit poster's website 
John Doe

Joined: 01 Aug 2005
Posts: 1689
Location: Michigan, US

PostPosted: Mon 27 Apr 2009, 02:05    Post subject:  

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-admin-made-easy/shadow-file-formats.html

up one level gives a boat load of additional info:

http://tldp.org/LDP/lame/LAME/linux-admin-made-easy/
Back to top
View user's profile Send private message 
dejan555


Joined: 30 Nov 2008
Posts: 2704
Location: Montenegro

PostPosted: Mon 27 Apr 2009, 03:13    Post subject:  

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?
_________________


Back to top
View user's profile Send private message Visit poster's website MSN Messenger 
dejan555


Joined: 30 Nov 2008
Posts: 2704
Location: Montenegro

PostPosted: Mon 27 Apr 2009, 10:01    Post subject:  

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.

_________________


Back to top
View user's profile Send private message Visit poster's website MSN Messenger 
dejan555


Joined: 30 Nov 2008
Posts: 2704
Location: Montenegro

PostPosted: Mon 27 Apr 2009, 10:08    Post subject:  

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

_________________


Back to top
View user's profile Send private message Visit poster's website MSN Messenger 
Pizzasgood


Joined: 04 May 2005
Posts: 6270
Location: Knoxville, TN, USA

PostPosted: Mon 27 Apr 2009, 16:09    Post subject:  

You can set the setuid bit on su by running this:
Code:
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.

_________________
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

Back to top
View user's profile Send private message Visit poster's website 
dejan555


Joined: 30 Nov 2008
Posts: 2704
Location: Montenegro

PostPosted: Mon 27 Apr 2009, 16:26    Post subject:  

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.

_________________


Back to top
View user's profile Send private message Visit poster's website MSN Messenger 
dejan555


Joined: 30 Nov 2008
Posts: 2704
Location: Montenegro

PostPosted: Mon 27 Apr 2009, 16:55    Post subject:  

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? Sad
_________________


Back to top
View user's profile Send private message Visit poster's website MSN Messenger 
Pizzasgood


Joined: 04 May 2005
Posts: 6270
Location: Knoxville, TN, USA

PostPosted: Mon 27 Apr 2009, 17:31    Post subject:  

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.
_________________
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

Back to top
View user's profile Send private message Visit poster's website 
dejan555


Joined: 30 Nov 2008
Posts: 2704
Location: Montenegro

PostPosted: Tue 28 Apr 2009, 01:18    Post subject:  

It didn't remember them beetween boots, haven't try remastering still. Or maybe when I logged in as root it somehow reset permissions. Question
_________________


Back to top
View user's profile Send private message Visit poster's website MSN Messenger 
Display posts from previous:   Sort by:   
Page 1 of 5 [61 Posts]   Goto page: 1, 2, 3, 4, 5 Next
Post new topic   Reply to topic View previous topic :: View next topic
 Forum index » Advanced Topics » Puppy Projects
Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.0980s ][ Queries: 12 (0.0058s) ][ GZIP on ]