LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 04-18-2024, 01:59 PM   #1
rizitis
Member
 
Registered: Mar 2009
Location: Greece,Crete
Distribution: Slackware64-current, Slint
Posts: 641

Rep: Reputation: 488Reputation: 488Reputation: 488Reputation: 488Reputation: 488
question about `su` and `su -l`


What is the the best way to check someone if he is in full root mode "su -l" or not like "su" in a Slackware system?

thank you.

EDIT:EXAMPLE
Code:
Thu Apr-4 10:06:59pm)-(CPU 0.8%:0:Net 16)-(omen:~)-(66M:158)
> id
uid=1000(omen) gid=100(users) groups=100(users),7(lp),10(wheel),17(audio),18(video),19(cdrom),71(input),83(plugdev),84(power),86(netdev),93(scanner),281(docker),996(vboxusers)
(Thu Apr-4 10:07:02pm)-(CPU 0.8%:0:Net 16)-(omen:~)-(66M:158)
> su
Password: 
(Thu Apr-4 10:07:02pm)-(CPU 0.8%:0:Net 16)-(root:/home/omen)-(66M:158)
> id
uid=0(root) gid=0(root) groups=0(root),1(bin),2(daemon),3(sys),4(adm),6(disk),10(wheel),17(audio)
(Thu Apr-4 10:07:02pm)-(CPU 0.8%:0:Net 16)-(root:/home/omen)-(66M:158)
> exit
exit
(Thu Apr-4 10:07:20pm)-(CPU 0.8%:0:Net 15)-(omen:~)-(66M:158)
> su -l
Password: 

Think big.
Pollute the Mississippi.

root@omen64:~# id
uid=0(root) gid=0(root) groups=0(root),1(bin),2(daemon),3(sys),4(adm),6(disk),10(wheel),17(audio)
root@omen64:~#
su and su -l gives the same output.

Last edited by rizitis; 04-18-2024 at 02:08 PM.
 
Old 04-18-2024, 02:09 PM   #2
Windu
Member
 
Registered: Aug 2021
Distribution: Arch Linux, Debian, Slackware
Posts: 591

Rep: Reputation: Disabled
Counter question, what else is there except a "full root mode"? You can not be a half-root, right?
Unless you limit someone's authorizations using sudoers but then you would have to prevent the use of "su" and only allow "sudo".
 
Old 04-18-2024, 02:29 PM   #3
gus3
Member
 
Registered: Jun 2014
Distribution: Slackware
Posts: 490

Rep: Reputation: Disabled
With "su -l", it's a "full login stuff" including the /etc/profile.d/* scripts.

But with "su", it's just for permissions, usually for root, and never mind all the "full login stuff".
 
2 members found this post helpful.
Old 04-18-2024, 02:31 PM   #4
rizitis
Member
 
Registered: Mar 2009
Location: Greece,Crete
Distribution: Slackware64-current, Slint
Posts: 641

Original Poster
Rep: Reputation: 488Reputation: 488Reputation: 488Reputation: 488Reputation: 488
Quote:
Originally Posted by Windu View Post
Counter question, what else is there except a "full root mode"? You can not be a half-root, right?
Unless you limit someone's authorizations using sudoers but then you would have to prevent the use of "su" and only allow "sudo".
a) Try su and then $PATH
b) Try su -l and then $PATH

did you adopted same PATH environment variables?
 
Old 04-18-2024, 02:35 PM   #5
Tonus
Senior Member
 
Registered: Jan 2007
Location: Paris, France
Distribution: Slackware-15.0
Posts: 1,405
Blog Entries: 3

Rep: Reputation: 514Reputation: 514Reputation: 514Reputation: 514Reputation: 514Reputation: 514
Check ENV PATH or bash_history ?

Edit : sorry,hadn't refreshed the page before answering

Last edited by Tonus; 04-18-2024 at 02:37 PM.
 
Old 04-18-2024, 02:37 PM   #6
volkerdi
Slackware Maintainer
 
Registered: Dec 2002
Location: Minnesota
Distribution: Slackware! :-)
Posts: 2,508

Rep: Reputation: 8473Reputation: 8473Reputation: 8473Reputation: 8473Reputation: 8473Reputation: 8473Reputation: 8473Reputation: 8473Reputation: 8473Reputation: 8473Reputation: 8473
Give this a try:

Code:
#!/bin/bash
if [ ! "$USER" = "root" ]; then
  echo "no su"
elif echo $XDG_CONFIG_DIRS | grep -q "^/home/" ; then
  echo "su"
else
  echo "su -l"
fi
 
1 members found this post helpful.
Old 04-18-2024, 02:46 PM   #7
rizitis
Member
 
Registered: Mar 2009
Location: Greece,Crete
Distribution: Slackware64-current, Slint
Posts: 641

Original Poster
Rep: Reputation: 488Reputation: 488Reputation: 488Reputation: 488Reputation: 488
Quote:
Originally Posted by volkerdi View Post
Give this a try:

Code:
#!/bin/bash
if [ ! "$USER" = "root" ]; then
  echo "no su"
elif echo $XDG_CONFIG_DIRS | grep -q "^/home/" ; then
  echo "su"
else
  echo "su -l"
fi
It give the same answer "su -l" for both su and su -l in my system.
The only thing I found so far is the $PATH cmd.
 
Old 04-18-2024, 02:54 PM   #8
volkerdi
Slackware Maintainer
 
Registered: Dec 2002
Location: Minnesota
Distribution: Slackware! :-)
Posts: 2,508

Rep: Reputation: 8473Reputation: 8473Reputation: 8473Reputation: 8473Reputation: 8473Reputation: 8473Reputation: 8473Reputation: 8473Reputation: 8473Reputation: 8473Reputation: 8473
Ah, I see. The previous script fails outside of an X environment.

Try this one:

Code:
#!/bin/bash
if [ ! "$USER" = "root" ]; then
  echo "no su"
elif [ -z "$XDG_RUNTIME_DIR" ]; then
  echo "su -l"
else
  echo "su"
fi
 
3 members found this post helpful.
Old 04-18-2024, 03:01 PM   #9
rizitis
Member
 
Registered: Mar 2009
Location: Greece,Crete
Distribution: Slackware64-current, Slint
Posts: 641

Original Poster
Rep: Reputation: 488Reputation: 488Reputation: 488Reputation: 488Reputation: 488
The reason of asking was this:
I made a fork of ktsuss and edited su_backend.c and su_backend.h
After this edits user can execute everything in full root mode even if user is not in wheel group and no sudo needed at all.
examples:
Code:
ktsuss gparted
ktsuss slackpkg update
ktsuss sbopkg -i package 
ktsuss ./Package.SlackBuild 
etc...
But I m not sure if its safe, if user is not in wheel group to do these?
I guess its safe because since user know root passwd he could do it in any case as root with the traditional way!
 
Old 04-18-2024, 03:03 PM   #10
rizitis
Member
 
Registered: Mar 2009
Location: Greece,Crete
Distribution: Slackware64-current, Slint
Posts: 641

Original Poster
Rep: Reputation: 488Reputation: 488Reputation: 488Reputation: 488Reputation: 488
Quote:
Originally Posted by volkerdi View Post
Ah, I see. The previous script fails outside of an X environment.

Try this one:

Code:
#!/bin/bash
if [ ! "$USER" = "root" ]; then
  echo "no su"
elif [ -z "$XDG_RUNTIME_DIR" ]; then
  echo "su -l"
else
  echo "su"
fi
That works! thanks PAT.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
ati driver question and console question kholdstayr Slackware 2 07-18-2005 03:30 PM
Bootloader question and a Slackware question Mr. Hill Linux - Newbie 6 02-14-2005 11:11 PM
Mount question and hot swap question Dr Gutiemouth Linux - Newbie 8 10-20-2004 12:30 PM
Question Concerning ISO's and one quick question. evrae Linux - Software 2 06-21-2004 03:53 AM
Phoenix Browser Question...And 1 other question... Grim Reaper Linux - Software 21 02-24-2003 08:20 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 10:10 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration