Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 4 years ago.
Improve this question
After a typo in a change to /etc/pam.d/sudo no user can sudo at all. The package cannot be modified as it requires sudo privileges, but all attempts result in rm: cannot remove ‘/etc/pam.d/sudo’: Permission denied and attemps to escalate to sudo result in sudo: PAM authentication error: Module is unknown. The package cannot be removed as it requires sudo. What is there to be done?
My account was part of the sudoers group, was able to pkexec vi /etc/pam.d/sudo and make the appropriate changes to the file as described here
In this situation where root access is required you have 2 options: (1) acquire the root password and fix pam.d/sudo or (2) boot with the install media with init=/bin/bash (or linux init=/bin/bash using LILO).
If you can't get the root password and must rely on the install media, then you will need to boot the install media, at the grub or lilo menu choose Boot Options and set:
init=/bin/bash (if you are using GRUB Boot loader)
linux init=/bin/bash (if you are using LILO Boot Loader)
Then check that the / filesystem is mounted read/write with the mount command. If not rw, then:
mount -o remount,rw /
You can then modify/replace pam.d/sudo. Reboot or telinit. (Note: you will need to modify the commands for systemd)
Related
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed last year.
Improve this question
"/etc/docker/daemon.json"
"/etc/docker/daemon.json" E212: Can't open file for writing
I’m currently trying to set up a Loki server, Promtail, and Grafana as docker images
I installed all the plugins needed however when I tried editing the docker daemon config file with this command
sudo nano /etc/docker/daemon.json
It does not allow me to write due to permissions so I tried using
sudo vi chmod 666 /etc/docker/daemon.json
but this only creates a new file in my directory called chmod
The docker containers are up but I can't see the Loki metrics on my web browser when I try to use localhost:3100/metrics neither can it can be added as a Datasource
Please can you help?
It should be sudo chmod 666 /etc/docker/daemon.json.
What you are doing is running vi against 3 files, chmod, 666, /etc/docker/daemon.json.
The directory /etc/docker must also exist as a directory, and not as a file.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 8 years ago.
Improve this question
I am trying to install python2.7 on a VM which is centos 6.5. I followed a following guide to install it
http://toomuchdata.com/2014/02/16/how-to-install-python-on-centos/
However when I try to install run python as sudo i get the following error.
-bash: python2.7: command not found
running just python2.7 works. It even works when i run it as a root user. Also I noticed that:
which python2.7
returns
/usr/bin/which: no python2.7
when I do sudo -i and then run the command.
Any idea why it is like that?
If you're using CentOS 6.5, this is likely due to the fact that sudo does not set /usr/local/bin as part of the PATH.
CentOS 6.x's /etc/sudoers file sets the secure_path (which is used during sudo sessions) to a very restricted set of paths.
Use the visudo command and look at the contents of your /etc/sudoers file. You will likely find this section:
#
# Adding HOME to env_keep may enable a user to run unrestricted
# commands via sudo.
#
# Defaults env_keep += "HOME"
Defaults secure_path = /sbin:/bin:/usr/sbin:/usr/bin
So sudo doesn't use the /usr/local/bin path.
You can solve your problem in a couple ways:
Add /usr/local/bin to the secure_path - This can open up security problems if you don't know what's gonna be in your /usr/local/bin directory. Though typically, this is probably not a huge concern because only root has write access to /usr/local/bin by default.
Disable secure_path entirely by commenting it out - again, you're overriding a feature designed to restrict access and improve security.
Try the following
sudo env PATH=$PATH python2.7
What this does is copy the current path you have into your new sudo's environment.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 3 years ago.
Improve this question
I have a samba share that I use in my home, this works fine on both Windows and Debian, but when trying to mount it on my Raspberry Pi I just get an error.
/etc/fstab:
//media.lan/public /media/media.lan cifs guest, uid=1000 0 0
dmesg:
[ 1497. 700485] CIFS VFS: Send error in SessSetup = -13
[ 1497. 703604] CIFS VFS: cifs_mount failed w/return code = -13
root#webcam:/home/pi# mount -a
mount error (13): Permission denied
Refer to the mount.cifs (8) manual page (e.g. man mount.cifs)
root#webcam:/home/pi#
Samba config: pastebin.com/dHjDUtMh
It look like you forget security option in your command, try this one:
sudo mount -t cifs //server-name/sharename /mnt/mntdir -o credentials=.mycredentials,sec=ntlmssp
If this one don't work change security from ntlmssp to ntlmv2.
EDIT:
Look like ntlmv2 is used more often
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 9 years ago.
Improve this question
I recently changed the permissions around for the /var/www/ directory on my Ubuntu 12.04 machine. Now my user can save to the directory but I get an error whenever I try to run the sudo command stating that my user is not in the sudoers file. I booted up grub to take a look and have tried to run "sudo usermod -G sudo kevin" a few times and get the error cannot lock /etc/passwd/; try again later. Is there any way to re add myself to that group without re-installing Ubuntu?
It sounds like your problem stems from the file system being mounted read-only as it is by default in recovery mode. Try remounting the filesystem in read-write mode using
"mount -o remount,rw /"
Are you sure your system is mounted in read/write mode when you're using GRUB? This can be achieved through the mount -o remount,rw / command.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 9 years ago.
Improve this question
I am trying to run a command that needs to write to the / folder. I added myself as user to sudoers file using sudo visudo. Added the following line at the end of file.
yedg ALL=(ALL) NOPASSWD: ALL
The command still fails complaining about permissions. Now this makes me wonder does adding to sudoers file allow me to run as root or does it give me privileges similar to root? Looks like the former. Am I right or did I miss something?
After you are added to sudoers file, you have permission to execute commands as root through sudo command.
Something like this:
sudo apt-get install skype
sudo rm -rf protectedDirectory
Actually sudo means substitute user do.