-1

Below I sun "su" command on FreeBSD:

FreeBSD rand.vstyle.local 9.0-RELEASE FreeBSD 9.0-RELEASE #0 amd64

This is server RAND :)

[svn@rand ~]$ su logostudiotest1 /bin/ls
Password:
/bin/ls: /bin/ls: cannot execute binary file

Why "su" does not work?!

porton
  • 312
  • 1
  • 14

3 Answers3

14

According to the su manpage if you want to run a command as another user using su, you should use the -c switch.

For example: su logostudiotest1 -c /bin/ls

MDMarra
  • 100,734
  • 32
  • 197
  • 329
1

I think you've confused su with sudo. This should work fine:

# sudo -u logostudiotest1 /bin/ls
Stephan
  • 999
  • 7
  • 11
0

I've had the problem while using chroot'ed 32-bit libraries on a 64-bit version of FreeBSD.

At first I thought something with ldconfig -32 might help, but than I noticed it was using PAM and/or several other authentication scheme that older programs didn't know.

I ended up just writing short C programs to chain the user shells or whatever else I needed to run, and then chmod'ed them to 4550 and used the group number (guid) to prevent unauthorized access to those programs. I could have also just programmed in a hard-coded password or whatever.

Android 3
  • 1
  • 1