ubuntu backup-manager Permission denied - linux

I've recently installed backup manager onto my ubuntu machine to have automated backup going. The problem is when I go to set up the automatization using this code -
it comes us up saying this "bash: /etc/backup-manager.sh: Permission denied"
I do not understand this error. I've tried change the user who read/writes to someone other than root and that didn't work. I tried changed the chmod number from 770 to 700 and still didn't work.
any info on this is welcome. Thank you to those who help :)
those wondering I am using this tutorial giving to me by the host. https://documentation.online.net/en/dedicated-server/tutorials/backup/configure-backup/start
I'm using the desktop version of ubuntu 16 incase that is needed

The sudo doesn't do what you want in this case. What happens is that the shell evaluates the redirection and attempts to open the /etc/backup-manager.sh for you before the sudo cat even gets started. That fails because the shell still runs as you unprivileged user. You have to say sudo -i to open a new root shell, execute the commands and exit again.
Alternatively you could try sudo nano /etc/backup-manager.sh and paste the contents there. This would work because the editor is run as root and does the file opening itself when you save.

Related

acess a protect folder using sudo in wsl

i'm using linux shell in my windows (wsl) and i'm trying to make a cd to a directory that needs permission.
I've saw some solutions here including using sudo su, to became a super user, but even with this code i'm not sucessful
sudo su
cd ./rootfs
I'm stuck in this problem fro a while, so what's is going on?
root#LAPTOP-FGSL14B2:/mnt/c/Users/giova/Appdata/Local/Packages/CanonicalGroupLimited.UbuntuonWindows_79rhkp1fndgsc/LocalState# cd ./rootfs
bash: cd: ./rootfs: Permission denied
It is a special folder, see: superuser.com/a/1446574/1083266
(I wanted to mark the question as a duplicate, but that is only valid for existing answers on stackoverflow)
I suspect that the folder you are trying to access required elevated permissions to view. Is the shell running as admin?
Sudo will not elevate the shell to allow for access to windows folders that the process does not have access to.
In the start menu right click the wsl or bash exe and select "run as admin" see if that works for you.

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.

VS Code on linux, various permissions errors

Is there any way to get vs code to work properly in linux? I can't run sudo code . because that gives me an error saying it's not secure to do so, I can't do anything within the editor to force doing things, like staging a file in git, or reloading a newly installed extension. I've googled around, and it seems nobody else has posted about this, and it seems highly unlikely that I'm the first to raise issue about this. (Take it easy on me, I'm a relatively new linux user). I'm trying to figure this out on Ubuntu 18.04 if that's relevant at all. My version of vs code is 1.30.2
I guess my main question is what's the right way to get applications like vs code to be able to perform tasks that required doing things without fighting the OS about sudo and privileges?
Launch via sudo from terminal
To launch VSCode as root --which is highly discouraged-- you must specify an alternate user data directory as follows:
$ sudo code --user-data-dir /path/to/alternate/folder
VSCode will automatically generate the required folders in the selected directory and launch with root privileges.
Change permissions to fix "permission denied" error
The solution in this case is to manually change the permissions of the two directories /home/$USER/.config/Code/ and /home/$USER/.vscode/. Perform these steps:
$ sudo chmod 755 /home/$USER/.config/Code
$ sudo chmod 755 /home/$USER/.vscode
To answer your other question:
If you really need to run several commands as root and you are annoyed by having to enter your password several times (when sudo has expired), just do sudo -i and you'll become root.
If you want to run commands using pipes, use sudo sh -c "comand1 | command2".
You may also want to take a look at this Ask Ubuntu answer about running applications as root.
I solve this problem using:
sudo chown -R YOUR_USER YOUR_PROJECT/
You basically need to tell the OS that you are the owner of the files you create. Use sudo chown <user name> <projects directory>
However, if you already created some files before applying chown, don't forget to change their permission also sudo chown <user name> <projects directory>/<file name>.

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