Page 2 of 2

Re: A strange request [Solved :) ]

Posted: 24 Jun 2016, 01:57
by brokenman
No, if one is mostly working in always fresh mode.
I guess every situation is different. I work exclusively from fresh mode, but I always have a personal settings module that gets loaded along with base to make my life easier. On my system, guest is in the wheel group and I rarely have to enter a password.

I don't think you can echo a password to su unless you trick it somehow.

Re: A strange request [Solved :) ]

Posted: 24 Jun 2016, 02:56
by donald
@ Ed
Yes, it's me again.. :)

Some observations:
One has to use the guest Pw

Code: Select all

guest@porteus:~$ echo guest | sudo -S activate ./tree.xzm
if one uses the root PW ,toor, you get

Code: Select all

guest@porteus:~$ echo toor | sudo -S activate ./tree.xzm
Password: Have a gorilla...
Password: 
sudo: 1 incorrect password attempt
guest@porteus:~$
BUT
once the Pw is given it seems to be valid for some time.
(some Minutes)

to check this behavior open a terminal, start a program with sudo,
-- i use xfce so i used thunar --, close it and reopen it again

Code: Select all

guest@porteus:~$ sudo thunar
Password: 
guest@porteus:~$ sudo thunar
guest@porteus:~$ sudo thunar
guest@porteus:~$ sudo thunar
as you can see i had to give the Pw only once.

this works as long as i do it in the same terminal
(I don't know how long exactly it will work)
If you open a 2nd terminal and invoke the same command (e.g.sudo thunar)
you will be asked for the Pw while you still can start thunar (or whatever)
in the 1st terminal without Pw.-- crazy.

I'm writing this as an explanation for myself (and you) because i could not believe
that the command

Code: Select all

guest@porteus:~$ echo toor | sudo -S activate ...
did work for you -- because "echo toor" is definitely wrong..

Re: A strange request [Solved :) ]

Posted: 24 Jun 2016, 03:33
by Ed_P
donald wrote:@ Ed
Yes, it's me again.. :)
Hey Don. Haven't heard from you in awhile. How are you? :D
I'm writing this as an explanation for myself (and you) because i could not believe
that the command

Code: Select all

guest@porteus:~$ echo toor | sudo -S activate ...
did work for you -- because "echo toor" is definitely wrong..
It does indeed work for me and in a new guest terminal window.

Code: Select all

guest@porteus:~$ chrome.sh
Activating Chrome module
Press Enter after Activated

Starting Chrome - takes a moment or two

Press Enter when done using Chrome.

Deactivating Chrome module

Cleaning up
guest@porteus:~$ 
A different script but same commands.

Code: Select all

if [ "$RUN_OPTION" = "" ]; then 
   echo Activating Chrome module
   echo toor | sudo -S activate $OPTIONAL/chrome.xzm     > /dev/null 2>&1 &
   echo Press Enter after Activated
   read


and


echo Deactivating Chrome module
echo toor | sudo -S deactivate $OPTIONAL/chrome.xzm     > /dev/null 2>&1 &
I do note that you are using Porteus 2.0 whereas I am using 3.0 so that may explain the difference results.

Will be interesting to see if it still works when I reboot in the morning. :D

Re: A strange request [Solved :) ]

Posted: 24 Jun 2016, 21:05
by donald
Hi Ed
--> you are using Porteus 2.0 ..<--
xfce 3.2 rc3 32Bit (always fresh) was used. :shock:

I'm at a loss.. :unknown:

Re: A strange request [Solved :) ]

Posted: 24 Jun 2016, 21:41
by Bogomips
^^^

Cinnamon 3.2rc3 got GUI dialog as well. :)

Re: A strange request [Solved :) ]

Posted: 24 Jun 2016, 21:42
by Ed_P
donald wrote:xfce 3.2 rc3 32Bit (always fresh) was used. :shock:
I was going by the Distribution shown on your user id. It could be a rc3 problem. I haven't tried it there, yet.

Re: A strange request [Solved :) ]

Posted: 24 Jun 2016, 22:32
by Ed_P
Yup. Me too. :( rc3 Cinnamon 64bit

Code: Select all

root@porteus:~# su guest
guest@porteus:/root$ cd /home/guest
guest@porteus:~$ ./chrome.sh
Password:                                                                <-------------------------------- 
Activating Chrome module
Press Enter after Activated

Starting Chrome - takes a moment or two

Press Enter when done using Chrome.

Deactivating Chrome module

Cleaning up
guest@porteus:~$ 
And only for the activate.

Code: Select all

if [ "$RUN_OPTION" = "" ]; then 
   echo Activating Chrome module
   echo toor | sudo -S activate $OPTIONAL/chrome.xzm     > /dev/null 2>&1 &
   echo Press Enter after Activated
   read
 :
 :

Re: A strange request [Solved :) ]

Posted: 24 Jun 2016, 23:15
by donald
Ed, may i ask you to do a (simple) test?

(re-) boot into pure always fresh (guest)
open a terminal and run a program, e.g.like mousepad, with sudo
(it must be a fresh boot-up, otherwise the Pw may still be saved/valid)

Code: Select all

guest@porteus:~$ sudo mousepad
Password: 
use the root PW -toor-....this should not work.

If it works, than there is something wrong with the implementation of sudo.
IMHO sudo is meant to let a restricted user run a command with elevated rights,
without knowing the root Pw.(someone might correct me here)

(that's why "echo guest" works while "echo toor" should not)

maybe Mr. brokenman can shed some light on this matter.

Re: A strange request [Solved :) ]

Posted: 24 Jun 2016, 23:30
by ncmprhnsbl
donald wrote:IMHO sudo is meant to let a restricted user run a command with elevated rights,
without knowing the root Pw.(someone might correct me here)
pretty sure sudo can be set up in a number of ways, including using the root password(or none), it just defaults to the current users password...
its purpose is temporary priviledge escalation(one process or script) without a continuing root login...

Re: A strange request [Solved :) ]

Posted: 25 Jun 2016, 00:11
by brokenman
pretty sure sudo can be set up in a number of ways, including using the root password(or none)
Yes this is correct. Compare both of your sudoers files and the problem should reveal itself. Also show if your user is in the wheel group or not.

EDIT:
Previously porteus only ever asked for the root password. Then we introduced sudo and sudoers was changed to ask for the root password so as not to confuse users. Sudo was gradually integrated and now should only ask for the user password.

Re: A strange request [Solved :) ]

Posted: 25 Jun 2016, 00:26
by donald
@ ncmprhnsbl, brokenman

Thanks for that.
I haven't thought about the fact that "sudo" might be configured differently
in the various versions of porteus.. :oops:

Ed, sorry for the confusion that I have caused.

Re: A strange request [Solved :) ]

Posted: 25 Jun 2016, 15:09
by Ed_P
donald wrote:Ed, may i ask you to do a (simple) test?

(re-) boot into pure always fresh (guest)
open a terminal and run a program, e.g.like mousepad, with sudo
(it must be a fresh boot-up, otherwise the Pw may still be saved/valid)

Code: Select all

guest@porteus:~$ sudo mousepad
Password: 
use the root PW -toor-....this should not work.
Sure.

Code: Select all

guest@porteus:~$ sudo mousepad

We trust you have received the usual lecture from the local System
Administrator. It usually boils down to these three things:

    #1) Respect the privacy of others.
    #2) Think before you type.
    #3) With great power comes great responsibility.

Password: 
I feel much better now.
Password: 
You do that again and see what happens...
Password: 
Two responses of "toor" one of "guest". And a banner at the top of Mousepad (a strange name for a text editor) shows:

Code: Select all

Warning, you are using the root account, you may harm your system.
And thank you brokenman for the explanation.
donald wrote: Ed, sorry for the confusion that I have caused.
No problem and no confusion. We've ended up with clarify. :good:

Thank you all. :beer: