CLI su --> switch user

Introduce yourself to us and other members here, or share your own product reviews, suggestions, and tips and tricks of using QNAP products.
User avatar
tajlor
Getting the hang of things
Posts: 52
Joined: Fri Jul 30, 2010 5:23 am

Re: CLI su --> switch user

Post by tajlor »

Here the results on my NAS:

as admin:
[~] which sudo
/Apps/opt/bin/sudo

[~] which visudo
/Apps/opt/sbin/visudo

[~] which opkg
/Apps/opt/bin/opkg

==> it seems i don't have installed optware because i don't have ipkg


visudo
...
## User privilege specification
root ALL=(ALL) ALL
admin ALL=(ALL) ALL
...

opkg update
Downloading http://qnapware.zyxmon.org/binaries-x86/Packages.gz.
Updated list of available packages in /Apps/opt/var/opkg-lists/packages.
User avatar
tajlor
Getting the hang of things
Posts: 52
Joined: Fri Jul 30, 2010 5:23 am

Re: CLI su --> switch user

Post by tajlor »

What's wrong with my configuration?
How can I fix it.
Sorry for the 1000 questions but I wanna fix this and need your help.

Thanks
User avatar
schumaku
Guru
Posts: 43579
Joined: Mon Jan 21, 2008 4:41 pm
Location: Kloten (Zurich), Switzerland -- Skype: schumaku
Contact:

Re: CLI su --> switch user

Post by schumaku »

Probably nothing - looks like somehting that does not work on the TS-x59 NAS ... my examples came from a TS-451.

TS-459 Pro, QTS 4.2.0 20151025

[~] # cat /Apps/opt/etc/sudoers
...
##
## User privilege specification
##
admin ALL=(ALL) ALL
...

[~] # sudo ks
sudo: unknown user: root
sudo: unable to initialize policy plugin

Bugger...check with the maker and maintainer of QNAPware/Entware.
User avatar
tajlor
Getting the hang of things
Posts: 52
Joined: Fri Jul 30, 2010 5:23 am

Re: CLI su --> switch user

Post by tajlor »

Can u give me a hint who this is?
User avatar
schumaku
Guru
Posts: 43579
Joined: Mon Jan 21, 2008 4:41 pm
Location: Kloten (Zurich), Switzerland -- Skype: schumaku
Contact:

Re: CLI su --> switch user

Post by schumaku »

Oh sorry please - create a new thread on the Entware sub-forum -> http://forum.qnap.com/viewforum.php?f=351 - feel free to quote my last reply with the "Probably nothing - looks like something that does not work on the TS-x59 NAS ..." right away.
User avatar
tajlor
Getting the hang of things
Posts: 52
Joined: Fri Jul 30, 2010 5:23 am

Re: CLI su --> switch user

Post by tajlor »

a note:
with the provided opkg v. 0.1.8-> http://forum.qnap.com/viewtopic.php?f=128&t=33213
"su" command works !!
BUMPRW
First post
Posts: 1
Joined: Tue Feb 23, 2016 6:44 am

Re: CLI su --> switch user

Post by BUMPRW »

I've been trying different things for weeks to get NodeJs module node-gyp to remain. On Fedora 23 I do have to use su and not sudo to install the module. On a QNAP TS253 pro it installs under some Nodejs versions but it will be gone in the next reboot. Yes I do know admin is suppose to be root, but it appears to lack the proper characteristics. If I attempt to install node-gyp as admin at best I have a short term fix that doesn't last and most likely and has wiped out all my Nodejs modules on the next reboot. I know the difference between sudo and su is critical in Parrallels, how do we get the same distinctions in QNAP's Busybox? I haven't figured it out yet.
Example:
Fedora 23
sudo npm install -g node-gyp # the operating system can't find npm
su
password: xxxx
npm install -g node-gyp # has no problem installing
exit

On QNAP
npm install -g node-gyp # most of the time it says it is installed but really isn't there
iam@nas
Easy as a breeze
Posts: 267
Joined: Wed Jun 15, 2016 2:49 am

Re: CLI su --> switch user

Post by iam@nas »

For me this works fine:
1. Make sure that you have a local user. Switching to domain users is as far as I can tell not possible.
grep bill /etc/passwd
Output: "bill:x:1234:1234:bill:/share/homes/bill:/bin/sh"

2. Make sure that you have sudo installed. I used opkg to install it
opkg list-installed | grep sudo
Output: "sudo - 1.8.xxx"

3. Switch user and start a shell as this is what you may want. Otherwise you may specify a process.
sudo -u bill /bin/sh
whoami
Output: "bill"
Here you may encounter problems with write permissions and the home directory which you may want to fix on your own. "homes" is protected so you may create a "home/bill" directory and set the permissions accordingly.
Post Reply

Return to “Users' Corner”