Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[VMAccessForLinux] sudo access with password #1073

Open
johanburati opened this issue Apr 8, 2020 · 3 comments
Open

[VMAccessForLinux] sudo access with password #1073

johanburati opened this issue Apr 8, 2020 · 3 comments

Comments

@johanburati
Copy link
Contributor

On the latest SLES15SP1 image (suse:sles-15-sp1-basic:gen2:2020.02.26)

targetpw is set by default in /etc/sudoers

When you deploy the VM the user can use sudo without the need to enter a password:

azureuser ALL = (ALL) NOPASSWD: ALL

But when you reset the user password from the Portal, it change the setting so that the user is require to enter a password:

azureuser ALL = (ALL) ALL

Since targetpw is set on this image, the user is prompt for the targetuser password, if the targetuser password is not set then the user cannot use sudo.

Is there a reason why the extension reset those settings and request the user to enter a password when using sudo ?

@camalloy
Copy link

Also having this same issue.

@camalloy
Copy link

We were able to fix this issue by using the run command (which runs as root) to fix the sudoers file:

configFile='/etc/sudoers'
sed -i '/Defaults targetpw/c# Defaults targetpw' $configFile
sed -i '/ALL/c# ALL ALL=(ALL) ALL' $configFile

tail -n 30 /etc/sudoers

@johanburati
Copy link
Contributor Author

johanburati commented Oct 24, 2020

People are pinging me about this issue, so I am sharing my reply below for reference:

Different users have different expectations I think it is hard to implement a solution that would fit all.
For example would the extension remove the targetuser option, some could argue that the extension could be used to circumvent the security policy.
So to me the best option when using the SLES images is to set the root password after deploying the VM or if you prefer to use the user password instead of the target user password when using sudo to comment that option like you did.
That way you will be to reset the password from the Portal using the extension and still keep sudo access.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants