question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Incorrect su usage for FreeBSD

See original GitHub issue

Using 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:closed
  • Created 3 years ago
  • Comments:14 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
Fizzadarcommented, Aug 23, 2020

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 release 1.1 this week 😃

1reaction
valpackettcommented, Aug 21, 2020

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 the login it won’t be processed by su)

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found