Incorrect su usage for FreeBSD
See original GitHub issueUsing su
results in hanging processes running:
su root -s /bin/sh -c stat /etc/installurl 1> /dev/null 2> /dev/null && (stat -c 'user=%U…
This is most likely because -s
does not mean something like “shell”, it means “Set the MAC label to the user’s default label as part of the user credential setup” (so does not take an argument), so we end up with sh
launched:
ec2-user@freebsd:~ $ su root -s /bin/sh -c stat /etc/installurl
root@freebsd:/home/ec2-user #
While this works:
ec2-user@freebsd:~ $ su root -s -c stat /etc/installurl
1895890688 94 crw--w---- 1 ec2-user tty 94 0 "Jul 23 12:36:27 2020" "Jul 23 12:36:27 2020" "Jul 23 12:36:27 2020" "Dec 31 23:59:59 1969" 4096 0 0 /dev/pts/0
ec2-user@freebsd:~ $ su root -c stat /etc/installurl
1895890688 94 crw--w---- 1 ec2-user tty 94 0 "Jul 23 12:36:27 2020" "Jul 23 12:36:27 2020" "Jul 23 12:36:27 2020" "Dec 31 23:59:59 1969" 4096 0 0 /dev/pts/0
Issue Analytics
- State:
- Created 3 years ago
- Comments:14 (9 by maintainers)
Top Results From Across the Web
How to Fix the “su: Sorry” Message After Installing FreeBSD
Solving the FreeBSD “su: Sorry” Problem ... The solution is to restart FreeBSD in single user mode and then make the change as...
Read more >su : Sorry | The FreeBSD Forums
Hi I just installed freebsd FreeBSD 7.1 on VMware, then installed GNOME with sysinstall and everything worked fine but then I decided to ......
Read more >"su" does not work on FreeBSD - Server Fault
According to the su manpage if you want to run a command as another user using su , you should use the -c...
Read more >FreeBSD: Becoming Super User (su) or Enabling su Access ...
The superuser is a privileged user with unrestricted access to all files and commands. The superuser has the special UID (user ID) 0....
Read more >Problem with su: Sorry : r/freebsd - Reddit
As u/Targren said, the "sudoers" file is for "sudo", while to use "su" (to root) you only need be a member of the...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
This should now be fixed by https://github.com/Fizzadar/pyinfra/commit/0c7234be0c3d02172da63f843260851b7ff66794! I’ve released this immediately as
1.1.dev2
and, assuming no further issues, will release1.1
this week 😃Yes, the assumption is incorrect. It is a bit weird: the
-c
argument to su that’s described above is not what you want, you want the-c
to be passed to the shell via the[args]
. (If it’s after thelogin
it won’t be processed bysu
)