Mailinglist Archive: opensuse (1264 mails)

< Previous Next >
Re: [opensuse] konsole
  • From: Knurpht - Gertjan Lettink <knurpht@xxxxxxxxxxxx>
  • Date: Thu, 22 Jun 2017 16:12:57 +0200
  • Message-id: <3163681.Lfja0ARpad@knurphtlaptop>
Op donderdag 22 juni 2017 14:43:14 CEST schreef Dave Plater:
On 22/06/2017 13:28, Anton Aylward wrote:
AFAIK and this has how it has always been. If I use su, I've never used
su -, my $HOME is /root and I have /sbin /usr/sbin added to my user's
$PATH.>

'su' according to 'man su'
When called without arguments, su defaults to running an interactive shell as
root.

For backward compatibility, su defaults to not change the current
directory and to only set the environment variables HOME and SHELL (plus USER
and LOGNAME if the target user is not root)


'su -' and 'su -l' according to 'man su'
-, -l, --login
Start the shell as a login shell with an environment similar to
a real login:

This leads to:

glosscomputer@knurphtlaptop:/> echo $PATH
/home/glosscomputer/bin:/usr/local/bin:/usr/bin:/bin:/home/glosscomputer/
Devel/grails//bin/:/usr/lib64/jvm/java/bin:/home/glosscomputer/Devel/grails//
bin/:/usr/lib64/jvm/java/bin

glosscomputer@knurphtlaptop:/> su
Wachtwoord:
knurphtlaptop:/ # echo $PATH
/home/glosscomputer/bin:/usr/local/bin:/usr/bin:/sbin:/usr/sbin:/bin:/home/
glosscomputer/Devel/grails//bin/:/usr/lib64/jvm/java/bin:/home/glosscomputer/
Devel/grails//bin/:/usr/lib64/jvm/java/bin
knurphtlaptop:/ # exit

glosscomputer@knurphtlaptop:/> su -
Wachtwoord:
knurphtlaptop:~ # echo $PATH
/sbin:/usr/sbin:/usr/local/sbin:/root/bin:/usr/local/bin:/usr/bin:/bin
knurphtlaptop:~ # logout

glosscomputer@knurphtlaptop:/> su -l
Wachtwoord:
knurphtlaptop:~ # echo $PATH
/sbin:/usr/sbin:/usr/local/sbin:/root/bin:/usr/local/bin:/usr/bin:/bin
knurphtlaptop:~ # logout
glosscomputer@knurphtlaptop:/> su knurpht
Wachtwoord:
knurpht@knurphtlaptop:/> echo $PATH
/home/glosscomputer/bin:/usr/local/bin:/usr/bin:/bin:/home/glosscomputer/
Devel/grails//bin/:/usr/lib64/jvm/java/bin:/home/glosscomputer/Devel/grails//
bin/:/usr/lib64/jvm/java/bin
knurpht@knurphtlaptop:/> exit
glosscomputer@knurphtlaptop:/> su -l knurpht
Wachtwoord:
knurpht@knurphtlaptop:~> echo $PATH
/home/knurpht/bin:/usr/local/bin:/usr/bin:/bin

AFAICS 'su -' and 'su -l' , on openSUSE at least, do the same.

Easy to test for other env variables.


You seem to be contradicting yourself.

How? I was merely pointing out that /sbin /usr/sbin are added to $PATH
in sudo su and su - you appeared to misrepresent this in your statement:
"It does not alter HOME, SHELL, USER, LOGNAME, and PATH."

First you agree with me, then you say the opposite.

Perhaps you'd perform a test for me.

1. bring up your system again from boot but in text mode not GUI mode.

2. Log in as a regular user.

3. Run the 'env' command ad save it to a file. /tmp/f1.txt

4. Now do the same, in turn, each of "su" and and "su -", each at the user
level prompt. Files F2.txt for the 'su" and F3.txt for the "su -"

Do you get asked for the password for eah of "su" and "su -"?

As user execute su and give required password, yes I'm asked for a
password going from user level to root level. If I'm logged in as root
via su and I execute su - I'm not asked for a password because I'm
already root.

Now do side-by-side "sdiff" (see the man page on this, and you might
consider using "diff3") on each combination of the files.

I used diff -y but I should have used sort on the files created from
env > myfile.txt before.

Please try reconciling that with what you find when you read the man page
for "su".
I've never had use for su apart from just switching users, I use it
every time I start my computer in konsole to have my first tab as root
in the same directory as my last session, my rpmbuild directory. I've
never been asked for a password by konsole and apart from setting white
background with black text never touch the settings. I'm not even going
to try to duplicate wol's problem by saving a profile after I've su'ed
or su-'ed, my problem with konsole failing to start due to a non
existent usb drive almost gave me a heart attack. Firefox, thunderbird,
konsole, okular, kwrite and midnight commander are my most important
applications and if something goes wrong konsole and mc are very
important. I'm addicted to the mouse and selecting, scrolling and pasting.

Let me -- or rather the list - know what you observe and what you
conclude.

I'm amazed that most of my environment is still there untouched. Still
the only important difference I can find between su and su- is $USER

I'm particularly interested in the difference between f2.txt and f3.txt.

In the interests of full disclosure, here's mine; the differ3ence between
"su" on the left and "su -" on the right.
https://paste.opensuse.org/87356798

As you can see, the "su" keeps a lot of the 'anton' environment.

Exactly what I get.

Of course alot of this is affected by the setting in /etc/pam.d for "su"
and "su-l", as well as polkit, /etc/ttydefs, /etc/login.defs, possibly
someting in sysconfig, and almost certainly (in my case) changes to
/etc/group.


it is also possible that TW is different, and that SLE has made LEAP
change, but do check what you observe with the man page. If in fact the
behaviour has changed, then the documentation needs changing.

I see there's a -p option to preserve the users environment, may be
useful to me in the future. I don't see any contradictions in the man page.

This is what the docco/man page says:

First, it recommends:
It is recommended to always use the --login option (instead of
its shortcut -) to avoid side effects caused by mixing environments.

and -l ?
I'm going to try env at runlevel 1 out of interest after I've sent this
reply.
Dave P


--
Gertjan Lettink, a.k.a. Knurpht

openSUSE Board Member
openSUSE Forums Team

--
To unsubscribe, e-mail: opensuse+unsubscribe@xxxxxxxxxxxx
To contact the owner, e-mail: opensuse+owner@xxxxxxxxxxxx

< Previous Next >
This Thread