You are not logged in.

#1 2017-04-02 05:34:03

earthw0rmjim
Member
From: Hungary
Registered: 2014-08-09
Posts: 9

[SOLVED] Why am i allowed to execute root commands as a regular user?

Hey guys,

I'm coming from Debian.
The strangest thing to me in Arch is that /sbin is just a symbolic link to /bin. As a regular user i can execute commands such as ifconfig, blkid, useradd, userdel etc. (although i cannot actually create or delete a user, just run the command).

Is there something wrong with my installation, or this is normal is Arch?
Isn't this a security risk? If not, why not?

I'd really appreciate if someone could explain the reason behind this.
Thank you in advance.

Last edited by earthw0rmjim (2017-04-02 11:38:06)

Offline

#2 2017-04-02 06:42:36

loafer
Member
From: the pub
Registered: 2009-04-14
Posts: 1,772

Re: [SOLVED] Why am i allowed to execute root commands as a regular user?

As far as I an recall it was done in order to simplify the directory structure and be in line with recommendations for using systemd.  As you point out you cannot actually modify or create a user as the binaries in question are read only for non privileged users, this is why it's not a security risk.

There is nothing wrong with your install.

edit:

Just did a quick search:

https://www.archlinux.org/news/binaries … ervention/
https://www.freedesktop.org/wiki/Softwa … eUsrMerge/

Last edited by loafer (2017-04-02 06:44:26)


All men have stood for freedom...
For freedom is the man that will turn the world upside down.
Gerrard Winstanley.

Offline

#3 2017-04-02 06:47:54

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 78,892

Re: [SOLVED] Why am i allowed to execute root commands as a regular user?

http://fedoraproject.org/wiki/Features/UsrMove

Also notice that the path has had provided really *no* access restriction - it's just whether it was in your $PATH or not - you could have /sbin/foo as long as you had suffient rights on the file and you still cannot /usr/bin/bar if you lack them.

Offline

#4 2017-04-02 07:59:08

graysky
Wiki Maintainer
From: :wq
Registered: 2008-12-01
Posts: 10,734
Website

Re: [SOLVED] Why am i allowed to execute root commands as a regular user?

earthw0rmjim wrote:

I'm coming from Debian.
...
As a regular user i can execute commands such as ifconfig, blkid, useradd, userdel etc. (although i cannot actually create or delete a user, just run the command).

That's to be expected isn't it?  Under debian, you can't call useradd?  On Arch it should end in a PAM failure.

Offline

#5 2017-04-02 10:01:49

Mr.Elendig
#archlinux@freenode channel op
From: The intertubes
Registered: 2004-11-07
Posts: 4,097

Re: [SOLVED] Why am i allowed to execute root commands as a regular user?

earthw0rmjim wrote:

Hey guys,

I'm coming from Debian.
The strangest thing to me in Arch is that /sbin is just a symbolic link to /bin. As a regular user i can execute commands such as ifconfig, blkid, useradd, userdel etc. (although i cannot actually create or delete a user, just run the command).

Is there something wrong with my installation, or this is normal is Arch?
Isn't this a security risk? If not, why not?

I'd really appreciate if someone could explain the reason behind this.
Thank you in advance.

  1. nothing stops you from running them on debian

  2. because it makes no sense to separate them these days since most of them have perfectly legal usage by unprivileged users too.


Evil #archlinux@libera.chat channel op and general support dude.
. files on github, Screenshots, Random pics and the rest

Offline

#6 2017-04-02 11:27:59

brebs
Member
Registered: 2007-04-03
Posts: 3,742

Re: [SOLVED] Why am i allowed to execute root commands as a regular user?

earthw0rmjim wrote:

As a regular user i can execute commands such as ifconfig, blkid, useradd, userdel etc. (although i cannot actually create or delete a user, just run the command).

You can in Debian, too. By running e.g.:

/sbin/ifconfig

The separation of /usr/sbin vs /usr/bin vs /bin vs /sbin was a historical PITA, which just caused tedious $PATH mistakes and cross-distro incompatibility.

Last edited by brebs (2017-04-02 11:28:16)

Offline

#7 2017-04-02 11:38:53

earthw0rmjim
Member
From: Hungary
Registered: 2014-08-09
Posts: 9

Re: [SOLVED] Why am i allowed to execute root commands as a regular user?

Thanks for all the answers.

Offline

#8 2017-04-02 15:10:21

brebs
Member
Registered: 2007-04-03
Posts: 3,742

Re: [SOLVED] Why am i allowed to execute root commands as a regular user?

2 types of commands were mentioned:

* ifconfig, which users might want to run because it can show useful info.

* adduser, which non-root users *cannot* usefully run, and are only runnable by non-root users because distro packagers are lazy (and maybe leaving the door open to weird, custom permission setups).

Offline

#9 2017-04-03 15:33:32

Lone_Wolf
Administrator
From: Netherlands, Europe
Registered: 2005-10-04
Posts: 15,567

Re: [SOLVED] Why am i allowed to execute root commands as a regular user?

$ useradd -h
Usage: useradd [options] LOGIN
       useradd -D
       useradd -D [options]

Options:
  -b, --base-dir BASE_DIR       base directory for the home directory of the
                                new account
  -c, --comment COMMENT         GECOS field of the new account
  -d, --home-dir HOME_DIR       home directory of the new account
  -D, --defaults                print or change default useradd configuration
  -e, --expiredate EXPIRE_DATE  expiration date of the new account
  -f, --inactive INACTIVE       password inactivity period of the new account
  -g, --gid GROUP               name or ID of the primary group of the new
                                account
  -G, --groups GROUPS           list of supplementary groups of the new
                                account
  -h, --help                    display this help message and exit
  -k, --skel SKEL_DIR           use this alternative skeleton directory
  -K, --key KEY=VALUE           override /etc/login.defs defaults
  -l, --no-log-init             do not add the user to the lastlog and
                                faillog databases
  -m, --create-home             create the user's home directory
  -M, --no-create-home          do not create the user's home directory
  -N, --no-user-group           do not create a group with the same name as
                                the user
  -o, --non-unique              allow to create users with duplicate
                                (non-unique) UID
  -p, --password PASSWORD       encrypted password of the new account
  -r, --system                  create a system account
  -R, --root CHROOT_DIR         directory to chroot into
  -s, --shell SHELL             login shell of the new account
  -u, --uid UID                 user ID of the new account
  -U, --user-group              create a group with the same name as the user

$

Looks like a succesful run as user to me ..
(adduser doesn't exist anymore on arch linux, useradd does)

P.S. yes, i know that's nitpicking

P.P.S.
Distro packagers were/are not the only lazy ones.
upstream devs put root-only commands in /sbin , later added options useful for normal users but didn't move the command.


Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.

clean chroot building not flexible enough ?
Try clean chroot manager by graysky

Offline

Board footer

Powered by FluxBB