Creating an account with root power but certain limitations The Next CEO of Stack OverflowUbuntu 11.10 Server: create user, home directory, sudo privileges: command line onlyI can not log into Ubuntu 12.04User created without a password behaves as if he had oneIs it safe for my ssh user to be given passwordless sudo for `apt-get update` and `apt-get upgrade`?Checking sudoers without root?Why is the root password on Linux Mint my user password?Add NOPASSWD in /etc/sudoers for only some specific commandsHow to verify proper configuration of passwordless sudo from userA to userB, from userB sessionHow to remote execute ssh command a sudo command without passwordForced user password change when login over SSH
Text adventure game code
Unreliable Magic - Is it worth it?
Was a professor correct to chastise me for writing "Prof. X" rather than "Professor X"?
How do I construct this japanese bowl?
How to write papers efficiently when English isn't my first language?
Is it okay to store user locations?
Why doesn't a table tennis ball float on the surface? How do we calculate buoyancy here?
Why do remote companies require working in the US?
Does it take more energy to get to Venus or to Mars?
How to count occurrences of text in a file?
Customer Requests (Sometimes) Drive Me Bonkers!
Rotate a column
How to safely derail a train during transit?
Why is there a PLL in CPU?
If the heap is initialized for security, then why is the stack uninitialized?
Anatomically Correct Mesopelagic Aves
Term for the "extreme-extension" version of a straw man fallacy?
Return of the Riley Riddles in Reverse
Why didn't Theresa May consult with Parliament before negotiating a deal with the EU?
WOW air has ceased operation, can I get my tickets refunded?
Is HostGator storing my password in plaintext?
The King's new dress
Is it my responsibility to learn a new technology in my own time my employer wants to implement?
How do I get the green key off the shelf in the Dobby level of Lego Harry Potter 2?
Creating an account with root power but certain limitations
The Next CEO of Stack OverflowUbuntu 11.10 Server: create user, home directory, sudo privileges: command line onlyI can not log into Ubuntu 12.04User created without a password behaves as if he had oneIs it safe for my ssh user to be given passwordless sudo for `apt-get update` and `apt-get upgrade`?Checking sudoers without root?Why is the root password on Linux Mint my user password?Add NOPASSWD in /etc/sudoers for only some specific commandsHow to verify proper configuration of passwordless sudo from userA to userB, from userB sessionHow to remote execute ssh command a sudo command without passwordForced user password change when login over SSH
How do one go about in creating an account with the following requirement:
- no home directory
- disabled password
- allow other users to su into this account to execute sudo commands.
- cannot ssh using this account
And also what are the security implications (if any) if such account is possible to be created?
Let assume that the OS is either CentOS or Ubuntu or Xubuntu.
sudo password
add a comment |
How do one go about in creating an account with the following requirement:
- no home directory
- disabled password
- allow other users to su into this account to execute sudo commands.
- cannot ssh using this account
And also what are the security implications (if any) if such account is possible to be created?
Let assume that the OS is either CentOS or Ubuntu or Xubuntu.
sudo password
You're asking for contradictory things. Why do you want such a thing anyway?
– Joseph Sible
yesterday
add a comment |
How do one go about in creating an account with the following requirement:
- no home directory
- disabled password
- allow other users to su into this account to execute sudo commands.
- cannot ssh using this account
And also what are the security implications (if any) if such account is possible to be created?
Let assume that the OS is either CentOS or Ubuntu or Xubuntu.
sudo password
How do one go about in creating an account with the following requirement:
- no home directory
- disabled password
- allow other users to su into this account to execute sudo commands.
- cannot ssh using this account
And also what are the security implications (if any) if such account is possible to be created?
Let assume that the OS is either CentOS or Ubuntu or Xubuntu.
sudo password
sudo password
asked yesterday
user275517user275517
1173
1173
You're asking for contradictory things. Why do you want such a thing anyway?
– Joseph Sible
yesterday
add a comment |
You're asking for contradictory things. Why do you want such a thing anyway?
– Joseph Sible
yesterday
You're asking for contradictory things. Why do you want such a thing anyway?
– Joseph Sible
yesterday
You're asking for contradictory things. Why do you want such a thing anyway?
– Joseph Sible
yesterday
add a comment |
1 Answer
1
active
oldest
votes
A user account must have a home directory, but the user does not necessarily need to have write permission to it. If the configured home directory is not accessible at all, the user gets the HOME environment variable set to / at the beginning of the user's session.
Disabled password is easy: just use passwd -l <username>. But then, you cannot use su <username> nor su - <username> to switch to the user with the disabled password unless you are root.
(For non-root users, switching with su requires entering the target user's password - and if the password has been disabled, that won't work.)
I think you're thinking about the sudo su - <username> syntax, which was the old workaround for obsolete versions of sudo with no -i option. It requires using two tools where one is sufficient: sudo su - <username> first uses sudo to make the user become root for the purpose of running su - <username> without a password prompt.
You can achieve the same thing with sudo -iu <username>, but it requires/allows configuring /etc/sudoers to grant the other users the specific permission to use sudo to switch to this username exclusively. In other words, to allow user someuser to switch to username using just sudo
someuser ALL=(root) /bin/su - username
you would configure
someuser ALL=(username) ALL
This will allow someuser to use sudo -iu username which is 100% equivalent to sudo su - username, but without involving the old su tool at all.
Likewise, if this user needs to run specific commands with root power, you would list the allowed commands explicitly in /etc/sudoers. For example, if this user needs to be able to start and stop a particular server, you would specify:
username ALL=(root) /usr/sbin/service servicename start,
/usr/sbin/service servicename stop
The restriction of "cannot ssh using this account" will be quite tricky to implement. Making the user unable to execute /usr/bin/ssh will not be sufficient: if the user can create files on the system, it means the user can bring their own ssh client onto the system and use that instead. You might consider setting an outgoing iptables rule with an owner match extension, to drop any packets going to port 22 from this user:
iptables -A OUTPUT -m owner -p tcp --dport 22 --uid-owner username -j DROP
But if this user has permission to run any commands as root through sudo, then the user will be able to become root and either side-step or undo all of these restrictions. So you'll need to carefully consider which commands this user needs to be able to run with root power.
add a comment |
Your Answer
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "106"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f508866%2fcreating-an-account-with-root-power-but-certain-limitations%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
A user account must have a home directory, but the user does not necessarily need to have write permission to it. If the configured home directory is not accessible at all, the user gets the HOME environment variable set to / at the beginning of the user's session.
Disabled password is easy: just use passwd -l <username>. But then, you cannot use su <username> nor su - <username> to switch to the user with the disabled password unless you are root.
(For non-root users, switching with su requires entering the target user's password - and if the password has been disabled, that won't work.)
I think you're thinking about the sudo su - <username> syntax, which was the old workaround for obsolete versions of sudo with no -i option. It requires using two tools where one is sufficient: sudo su - <username> first uses sudo to make the user become root for the purpose of running su - <username> without a password prompt.
You can achieve the same thing with sudo -iu <username>, but it requires/allows configuring /etc/sudoers to grant the other users the specific permission to use sudo to switch to this username exclusively. In other words, to allow user someuser to switch to username using just sudo
someuser ALL=(root) /bin/su - username
you would configure
someuser ALL=(username) ALL
This will allow someuser to use sudo -iu username which is 100% equivalent to sudo su - username, but without involving the old su tool at all.
Likewise, if this user needs to run specific commands with root power, you would list the allowed commands explicitly in /etc/sudoers. For example, if this user needs to be able to start and stop a particular server, you would specify:
username ALL=(root) /usr/sbin/service servicename start,
/usr/sbin/service servicename stop
The restriction of "cannot ssh using this account" will be quite tricky to implement. Making the user unable to execute /usr/bin/ssh will not be sufficient: if the user can create files on the system, it means the user can bring their own ssh client onto the system and use that instead. You might consider setting an outgoing iptables rule with an owner match extension, to drop any packets going to port 22 from this user:
iptables -A OUTPUT -m owner -p tcp --dport 22 --uid-owner username -j DROP
But if this user has permission to run any commands as root through sudo, then the user will be able to become root and either side-step or undo all of these restrictions. So you'll need to carefully consider which commands this user needs to be able to run with root power.
add a comment |
A user account must have a home directory, but the user does not necessarily need to have write permission to it. If the configured home directory is not accessible at all, the user gets the HOME environment variable set to / at the beginning of the user's session.
Disabled password is easy: just use passwd -l <username>. But then, you cannot use su <username> nor su - <username> to switch to the user with the disabled password unless you are root.
(For non-root users, switching with su requires entering the target user's password - and if the password has been disabled, that won't work.)
I think you're thinking about the sudo su - <username> syntax, which was the old workaround for obsolete versions of sudo with no -i option. It requires using two tools where one is sufficient: sudo su - <username> first uses sudo to make the user become root for the purpose of running su - <username> without a password prompt.
You can achieve the same thing with sudo -iu <username>, but it requires/allows configuring /etc/sudoers to grant the other users the specific permission to use sudo to switch to this username exclusively. In other words, to allow user someuser to switch to username using just sudo
someuser ALL=(root) /bin/su - username
you would configure
someuser ALL=(username) ALL
This will allow someuser to use sudo -iu username which is 100% equivalent to sudo su - username, but without involving the old su tool at all.
Likewise, if this user needs to run specific commands with root power, you would list the allowed commands explicitly in /etc/sudoers. For example, if this user needs to be able to start and stop a particular server, you would specify:
username ALL=(root) /usr/sbin/service servicename start,
/usr/sbin/service servicename stop
The restriction of "cannot ssh using this account" will be quite tricky to implement. Making the user unable to execute /usr/bin/ssh will not be sufficient: if the user can create files on the system, it means the user can bring their own ssh client onto the system and use that instead. You might consider setting an outgoing iptables rule with an owner match extension, to drop any packets going to port 22 from this user:
iptables -A OUTPUT -m owner -p tcp --dport 22 --uid-owner username -j DROP
But if this user has permission to run any commands as root through sudo, then the user will be able to become root and either side-step or undo all of these restrictions. So you'll need to carefully consider which commands this user needs to be able to run with root power.
add a comment |
A user account must have a home directory, but the user does not necessarily need to have write permission to it. If the configured home directory is not accessible at all, the user gets the HOME environment variable set to / at the beginning of the user's session.
Disabled password is easy: just use passwd -l <username>. But then, you cannot use su <username> nor su - <username> to switch to the user with the disabled password unless you are root.
(For non-root users, switching with su requires entering the target user's password - and if the password has been disabled, that won't work.)
I think you're thinking about the sudo su - <username> syntax, which was the old workaround for obsolete versions of sudo with no -i option. It requires using two tools where one is sufficient: sudo su - <username> first uses sudo to make the user become root for the purpose of running su - <username> without a password prompt.
You can achieve the same thing with sudo -iu <username>, but it requires/allows configuring /etc/sudoers to grant the other users the specific permission to use sudo to switch to this username exclusively. In other words, to allow user someuser to switch to username using just sudo
someuser ALL=(root) /bin/su - username
you would configure
someuser ALL=(username) ALL
This will allow someuser to use sudo -iu username which is 100% equivalent to sudo su - username, but without involving the old su tool at all.
Likewise, if this user needs to run specific commands with root power, you would list the allowed commands explicitly in /etc/sudoers. For example, if this user needs to be able to start and stop a particular server, you would specify:
username ALL=(root) /usr/sbin/service servicename start,
/usr/sbin/service servicename stop
The restriction of "cannot ssh using this account" will be quite tricky to implement. Making the user unable to execute /usr/bin/ssh will not be sufficient: if the user can create files on the system, it means the user can bring their own ssh client onto the system and use that instead. You might consider setting an outgoing iptables rule with an owner match extension, to drop any packets going to port 22 from this user:
iptables -A OUTPUT -m owner -p tcp --dport 22 --uid-owner username -j DROP
But if this user has permission to run any commands as root through sudo, then the user will be able to become root and either side-step or undo all of these restrictions. So you'll need to carefully consider which commands this user needs to be able to run with root power.
A user account must have a home directory, but the user does not necessarily need to have write permission to it. If the configured home directory is not accessible at all, the user gets the HOME environment variable set to / at the beginning of the user's session.
Disabled password is easy: just use passwd -l <username>. But then, you cannot use su <username> nor su - <username> to switch to the user with the disabled password unless you are root.
(For non-root users, switching with su requires entering the target user's password - and if the password has been disabled, that won't work.)
I think you're thinking about the sudo su - <username> syntax, which was the old workaround for obsolete versions of sudo with no -i option. It requires using two tools where one is sufficient: sudo su - <username> first uses sudo to make the user become root for the purpose of running su - <username> without a password prompt.
You can achieve the same thing with sudo -iu <username>, but it requires/allows configuring /etc/sudoers to grant the other users the specific permission to use sudo to switch to this username exclusively. In other words, to allow user someuser to switch to username using just sudo
someuser ALL=(root) /bin/su - username
you would configure
someuser ALL=(username) ALL
This will allow someuser to use sudo -iu username which is 100% equivalent to sudo su - username, but without involving the old su tool at all.
Likewise, if this user needs to run specific commands with root power, you would list the allowed commands explicitly in /etc/sudoers. For example, if this user needs to be able to start and stop a particular server, you would specify:
username ALL=(root) /usr/sbin/service servicename start,
/usr/sbin/service servicename stop
The restriction of "cannot ssh using this account" will be quite tricky to implement. Making the user unable to execute /usr/bin/ssh will not be sufficient: if the user can create files on the system, it means the user can bring their own ssh client onto the system and use that instead. You might consider setting an outgoing iptables rule with an owner match extension, to drop any packets going to port 22 from this user:
iptables -A OUTPUT -m owner -p tcp --dport 22 --uid-owner username -j DROP
But if this user has permission to run any commands as root through sudo, then the user will be able to become root and either side-step or undo all of these restrictions. So you'll need to carefully consider which commands this user needs to be able to run with root power.
answered yesterday
telcoMtelcoM
20.1k12450
20.1k12450
add a comment |
add a comment |
Thanks for contributing an answer to Unix & Linux Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f508866%2fcreating-an-account-with-root-power-but-certain-limitations%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
You're asking for contradictory things. Why do you want such a thing anyway?
– Joseph Sible
yesterday