Sudo is broken on linux mint 17.3 - linux

When I execute
sudo apt-get install composer
Following error occurred:
sudo: error in /etc/sudo.conf, line 0 while loading plugin `sudoers_policy'
sudo: /usr/lib/sudo/sudoers.so must be only be writable by owner
sudo: fatal error, unable to load plugins
and don't know the root password. Please suggest me a solution

Your system is broken. Unless you changed the permission specifically on that file, there's a good chance other files are also affected by the same issue.
If it's just this file for some reason, you can boot from a live CD, mount your root filesystem, and run chmod 0600 /path/to/usr/lib/sudo/sudoers.so.
Otherwise, either you or something you used ran chmod 0777 on your /usr or other directory when it should never happen. Realistically, your best option in this case if to backup your data, reinstall the system and restore. You could attempt recovery, but since you posted this question, it's probably too advanced.

Related

/usr/bin/env: node: Permission denied

As the title suggests I am receiving the error
/usr/bin/env: node: Permission denied
when trying to run
npm run build
for my react app. The following link is the leadup to this point with all that I've done and tried, not to be included here for the sake of not duplicating questions Error with react-scripts in npm run build.
Additionally, I have viewed this posting, Getting Error /usr/bin/env: node : Permission Denied, and it was unhelpful to me.
Any help is much appreciated.
I was working in a dockerized node environment and noticed that the mounted source code directory had different ownership (running the container as root) from host environment. Changing the ownership using:
chown -R root:root .
made the error go away for me!
The issue ended up being a matter of file ownership. Root was the owner of many things for the project rather than my profile. Simply changed the ownership from root to me.
For me, re-installing node with NVM solved the issue:
Install nvm
nvm install 14
nvm use 14
you should running command as super user sudo npm run build
For anyone else hitting this, there is another avenue of investigation. There might be another factor affecting execute permissions. There's an exec flag on drive mounts to enable script execution (neat safety feature for automounted usb sticks!). So if your code is on a drive that you've mounted, you need that option set to run scripts on it. Tell-tale signs are the permissions on the script being correct (appropriate user, group and execute bits set), but it still complaining about the shebang line (1st line) being the permission denied. Also, if you type mount, you might see noexec set on the mount point where your source code is (it may not show here if exec is set). How your mount is set up varies greatly, but a place to start is your /etc/fstab.

Installing rclone according to the official instructions but permission denied

Noob question, but hear me out
So I installed rclone word-for-word according to this (https://rclone.org/install/)
However, when I got around to rclone config the terminal returned 2020/02/28 11:37:29 Failed to load config file "/home/myUser/.config/rclone/rclone.conf": open /home/myUser/.config/rclone/rclone.conf: permission denied
In an attempt to fix this I ran chmod u+x "/home/myUser/.config/rclone/rclone.conf" which returned chmod: changing permissions of '/home/myUser/.config/rclone/rclone.conf': Operation not permitted
Then I ran the same command prefixed with sudo which seemed to work. Yet after running rclone config again the same permission denied error appeared. What should I do? What did I do incorrectly during install? I just want to be able to run rclone config without having to use sudo.
Unrelated side note I had a similar experience with Anaconda in which I can't run the command for opening the program without sudo but as I ran the command with it the launcher appears with an error message which I can't remember exactly but it ran along the lines of: "Cannot run in sudo mode, please do it again in user mode." Funny Catch-22 if you ask me. I ended up uninstalling it.
Solution: set the permissions of rclone.conf to chmod 777. I changed the whole folder and its files using sudo chmod -R 777 /home/myUser/.config/rclone/ for good measure. Now I can finally retry installing Anaconda.

sudo su command not working in OEL 7

I want to install glibc-2.17-105.el7.i686
But I'm not able to do sudo yum install.
sudo yum install glibc-2.17-105.el7.i686 , gives error
-bash: /usr/local/bin/sudo: /lib/ld-linux.so.2: bad ELF interpreter: No such file or directory
bash: /usr/local/bin/sudo: /lib/ld-linux.so.2: bad ELF interpreter
This means:
You have a 32-bit /usr/local/bin/sudo binary and
You do not have 32-bit runtime libraries installed.
If you are lucky, you have a 64-bit /usr/bin/sudo (/usr/local/bin is not the default location for sudo). If so, you should be able to do this:
/usr/bin/sudo rm /usr/local/bin/sudo
after which "normal" 64-bit sudo (which would now be /usr/bin/sudo) will just work.
If you are unlucky, but your system allows root login (and you know root password), then simply login as root, and:
# should make 32-bit /usr/local/bin/sudo work
root#host# yum install glibc-2.17-105.el7.i686
If you have no root password, and no working sudo, not all is lost: with physical access to the system, you could boot off the recovery disk, mount your root filesystem, and fix root password. You may as well copy a working sudo to /usr/bin at the same time.
From my experience you are in a bad situation. It's very bad that you have lib errors, I believe because of this error you will have problems running most of your executables on your system and that makes debugging and fixing much harder.
It's most likely a filesystem corruption but I'm not sure if it can be fixed.
I would try to go to single user mode, remount / as read only, then do a fsck on it(depending on your filesystem it may be e2fsck or other).
If it doesn't work, another path would be to boot from a rescue disk and do fsck or try other methods of fixing.
You may have to backup any data and reinstall. Please backup ASAP!
Good luck!

RStudio cannot reach .Rhistory on Ubuntu

I was working with markdown file on RStudio. I have Ubuntu 14.04 on my laptop. I produce html files using knitr. I decided to clean my enviroment and added rm and gc commands at the end.
Now here is a message in my console window:
Error attempting to read history from ~/.Rhistory: permission denied (is the .Rhistory file owned by root?)
What it means? Is it bad for my code?
You are right - the first time you ran it, you were in sudo mode, and the .Rhistory file was created with root as the owner. Running RStudio as root would remove the symptom, but is not ideal. To be able to run it as a regular user, simply change the owner of the .Rhistory file:
sudo chown -c <user_name> .Rhistory
In the best traditions of stackoverflow I reply to my own question! The problem occurred because when I first started R, I did it as su:
sudo R
so I can load a lot of useful libraries in /usr/lib/R/site-library and not in my account. As result .Rhistory became su file. It is possible for RStudio to see it if it is started as
sudo rstudio
and then all is fine.

pid file disappears after starting pgpool with ubuntu and postgresql

I´ve installed postgresql 9.1 on ubuntu 12.04 with pgpoolII-3.3.3 and pgPoolAdmin
If I try to run pgpool from a terminal with sudo pgpool it seems to start. Viewing ubuntu file explorer I can see how a pgpool.pid file is created at /var/run/pgpool/pgpool.id (this is the path in pgpool.conf)
But after one second the file disappears.
I have tried to change the owner of the directory and the directory permissions but nothing seems to fix it.
If after that I try to stop pgpool wiht sudo pgpool -m fast stop I got an error: Error. pid file not found
It seems like the file is created and suddenly destroyed. I´m wondering why.
If I try to run pgpool from pgPoolAdmin I got this error: pgpool start failed. pgpool.pid not found.
Like other times, it´s maybe and stupid issue and I´m not being able to solve it as i don´t have a high level of knowledge on those systems.
Any idea about what to try?
Xrry Christmas
Solved. I think the problem was caused by a permission problem. After trying
sudo mkdir /var/run/pgpool
sudo chmod 777 /var/run/pgpool
sudo chown postgres/postgres /var/run/pgpool
sudo postgresql service restart
It seems to be working now.
check the tmp directory using ls -la command and delete the file .s.PGSQL.9999 and .s.PGSQL.9898 and restart the server
Upon configuring PgPool-II, I found some documentation explaining that using the default directory /var/run/pgpool for the PID file was a bad idea, for that file could be erased when the service reboots.
The contents of the /var/run directory (including the pgpool
directory) may be removed by the operating system during a reboot. The
/var/run/pgpool directory should NOT be used as the location for the
pgpool.pid file.
The issue seems to occur when using Ubuntu.
So a possible solution would be to store the PID file in a directory named so as to not match the name of a service that could be rebooted. For instance, you could change the pgpool.conf file :
pid_file_name = '/var/run/pgpool4ever/pgpool.pid'
I could not try it on my own as I do not use Ubuntu, but maybe this could help someone facing a similar problem. Although I am not sure that it is very wise to go past basic Ubuntu way of working....

Resources