Add user to sudoers
-
- Getting the hang of things
- Posts: 92
- Joined: Wed Oct 21, 2015 2:15 am
Add user to sudoers
Hi!
For security reason I'd disable the standard admin user and created a new one in the Administrators user group. Yet this user is not allowed everthing on the system (swapoff for instance is denied and is allowed to Admin). Also it is not allowed to sudo.
How do I add a new administrator user to the sudoers? (there is no visudo available )
For security reason I'd disable the standard admin user and created a new one in the Administrators user group. Yet this user is not allowed everthing on the system (swapoff for instance is denied and is allowed to Admin). Also it is not allowed to sudo.
How do I add a new administrator user to the sudoers? (there is no visudo available )
QNAP TS-453mini
Firmware: up to date
Firmware: up to date
-
- First post
- Posts: 1
- Joined: Fri Jun 12, 2020 9:45 pm
Re: Add user to sudoers
login to your Qnap via ssh with admin user
edit /usr/etc/sudoers file
and add the following line
Code: Select all
ssh admin@your-nas-ip
Code: Select all
vim /usr/etc/sudoers
Code: Select all
your-user-name ALL=(ALL) ALL
- OneCD
- Guru
- Posts: 12141
- Joined: Sun Aug 21, 2016 10:48 am
- Location: "... there, behind that sofa!"
Re: Add user to sudoers
Last time I checked, QTS doesn't use 'sudo'.
Can someone please confirm if there exists a [/usr/etc/sudoers] file on their NAS?
Can someone please confirm if there exists a [/usr/etc/sudoers] file on their NAS?
- dolbyman
- Guru
- Posts: 35248
- Joined: Sat Feb 12, 2011 2:11 am
- Location: Vancouver BC , Canada
Re: Add user to sudoers
I have that file .. yes (every single line commented out on my 853Bu)
actually this one is not commencted out
Code: Select all
## User privilege specification
##
admin ALL=(ALL) ALL
httpdusr ALL=(ALL) NOPASSWD:ALL
- OneCD
- Guru
- Posts: 12141
- Joined: Sun Aug 21, 2016 10:48 am
- Location: "... there, behind that sofa!"
Re: Add user to sudoers
Thanks @dm.
What firmware version is that?
Do you have a working ‘sudo’ binary too?
What firmware version is that?
Do you have a working ‘sudo’ binary too?
- dolbyman
- Guru
- Posts: 35248
- Joined: Sat Feb 12, 2011 2:11 am
- Location: Vancouver BC , Canada
- OneCD
- Guru
- Posts: 12141
- Joined: Sun Aug 21, 2016 10:48 am
- Location: "... there, behind that sofa!"
- dolbyman
- Guru
- Posts: 35248
- Joined: Sat Feb 12, 2011 2:11 am
- Location: Vancouver BC , Canada
Re: Add user to sudoers
oh you meant the program that reads the config file .. lol
here:
here:
Code: Select all
[~] # which sudo
/usr/bin/sudo
- OneCD
- Guru
- Posts: 12141
- Joined: Sun Aug 21, 2016 10:48 am
- Location: "... there, behind that sofa!"
Re: Add user to sudoers
Hmm, so QTS now has 'sudo' ... nice!
I'll remove my suspicions from my first post.
-
- First post
- Posts: 1
- Joined: Tue Jun 23, 2020 2:28 am
Re: Add user to sudoers
the sudoers file is recreated by some script in the qnap each time the nas is restarted. unleast you find the script and modify it (with a potential brick in the next restart because a sintax error) you'll have to recreate the modification every time your nas is rebooted... you could do it with a cron script that adds the user to the sudo group
-
- New here
- Posts: 8
- Joined: Thu Apr 02, 2020 3:46 am
Re: Add user to sudoers
I'm having the same problem.
Can someone please post a working solution for this?
Can someone please post a working solution for this?
- dolbyman
- Guru
- Posts: 35248
- Joined: Sat Feb 12, 2011 2:11 am
- Location: Vancouver BC , Canada
Re: Add user to sudoers
solution to add to sudo (and modify startup to make it "permanent") was already posted further up
-
- New here
- Posts: 5
- Joined: Sat Nov 12, 2016 7:19 pm
Re: Add user to sudoers
0. Create your own username and edit the access permission for SSH in the QNAP controlpanel
1. Install Entware
2. Login as admin with ssh.
3. opkg update
4. opkg install sudo
5. Edit /opt/etc/sudoers and add "<yourusername> ALL=(ALL) ALL"
6. Logout and login with your own username
7. In the user directory add a file with the name ".profile" and add the line "export PATH=/opt/bin:$PATH"
8. logout and login DONE
1. Install Entware
2. Login as admin with ssh.
3. opkg update
4. opkg install sudo
5. Edit /opt/etc/sudoers and add "<yourusername> ALL=(ALL) ALL"
6. Logout and login with your own username
7. In the user directory add a file with the name ".profile" and add the line "export PATH=/opt/bin:$PATH"
8. logout and login DONE
-
- New here
- Posts: 2
- Joined: Tue Jun 11, 2019 11:43 pm
Re: Add user to sudoers
Can you explain how you can install Entware in detail?
I tried to follow your steps, but I found it to be difficult to replicate.
It must be missing some intermediate steps...
I tried to follow your steps, but I found it to be difficult to replicate.
It must be missing some intermediate steps...
- OneCD
- Guru
- Posts: 12141
- Joined: Sun Aug 21, 2016 10:48 am
- Location: "... there, behind that sofa!"
Re: Add user to sudoers
Hi Paul and welcome to the forum.
As you have asked, I see a big red-flag that you're probably trying to solve a problem the wrong way.
May I ask: what are you trying to fix?
I'm wondering if you really need the advice in this topic then? This topic is for those with some experience at the command shell - at least enough that they don't need to ask how to install Entware.
As you have asked, I see a big red-flag that you're probably trying to solve a problem the wrong way.
May I ask: what are you trying to fix?