On Sat, Oct 18, 2014 at 07:29:59AM +0200, Alessandro DE LAURENZIS wrote:
> On Fri 17/10 17:39, Raimo Niskanen wrote:
> > 
> > As I read the man page for su it is the target's login shell that is
> > invoked, and it need not always be /bin/sh - it can be changed.
> > 
> > Therefore I suspect that you want "-s /bin/sh " between "su " and "root".
> 
> I'm confused:
> 
> just22@poseidon:[~]> sudo su -s /bin/sh root -c date
> Sat Oct 18 07:21:40 CEST 2014
> 
> just22@poseidon:[~]> su -s /bin/sh root -c date
> su: only the superuser may specify a login shell
> 
> (this is really weird).

That is not weird.  sudo changes user (to root by default) and then calls
"su -s /bin/sh root -c date" and root is allowed to specify a login shell.

But just22 is not allowed by su to specify a login shell.

> 
> Moreover, using the following:
> 
> #define SUCMD "-fn 7x14 -geometry 60x4 -e su root -c 'nohup xfe >/dev/null 
> 2>&1 & sleep 1'"
> 
> xfe correctly opens the password's window, but the echo is active during
> typing... (the same doesn't happen when I use sudo).

I can only make wild guesses here, but it might be related to exactly how
xfe starts the new process that gets this $SUCMD string; if it allocates a
PTY or not, and sudo maybe fixes the situation when it is used...

But the su arguments -c 'nohup xfe >/dev/null 2>&1 & sleep 1' are not
portable as they assume root's login shell is a Bourne style shell; just as
-c 'nohup xfe >& /dev/null & sleep 1' assumes a Csh style shell (that line
may come from FreeBSD since they per default use Csh as root login shell)

Perhaps -c 'nohup xfe >/dev/null & sleep 1' works well enough and is
portable enough...

> 
> It's just me?
> 
> 
> -- 
> Alessandro DE LAURENZIS
> [mailto:just22....@gmail.com]
> LinkedIn: http://it.linkedin.com/in/delaurenzis

-- 

/ Raimo Niskanen, Erlang/OTP, Ericsson AB

Reply via email to