I've been having a lot of trouble trying to set up a path to an executable file in linux. Sorry If it's a dumb question, but I'm new to linux and still figuring things out.
Anyways, the file I want to create a path to is located at:
/opt/gitools/gitools-2.3.1/gitools
So I created a path at the end of my .bashrc file:
export PATH=$PATH:/opt/gitools/gitools-2.3.1/
I've checked, and the file gitools as well as all parent directories are marked as executable. However, when I enter "gitools", it returns:
/bin/bash: /opt/gitools/gitools-2.3.1/gitools: Permission denied
And when I enter "sudo gitools", it returns:
sudo: gitools: command not found
There is nothing wrong with the program itself, because I can run it by going to its directory and entering "sudo ./gitools", however, I'm unsure of why I need sudo when it should be executable for all users.
Any help is greatly appreciated!
I finally figured out a solution that works.
I tried to give full read write execute permission to all files in the program, but that just created errors that prevented running the program at all.
However, I noticed that the owner of all of the files was set to root, so in a last ditch attempt to get it to work I decided to recursively change the ownership of all directories and files associated with the program by going to the /opt directory and entering:
sudo chown -R myUsername:myUsername gitools/
Hope that this might help someone with a similar problem!
Related
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.
I need subprocess in my script to connect with 3G. But unfurtunately it's throwing me alot of errors. So I was hoping maybe someone here could help me.
My code:
import subprocess
import time
subprocess.run('sudo ./sakis3g connect OTHER="USBMODEM" USBMODEM="12d1:1001" APN="internet"', shell=True)
When I run this simple script in my home directory I get the following error:
sudo: ./sakis3g: command not found
Is it maybe because the sakis3g script itself it located in /usr/local/bin. Any help would be appreciated, thanks in advance
I run this simple script in my home directory
./ means the current directory i.e. the home directory in this case.
Is it maybe because the sakis3g script itself it located in /usr/local/bin
/usr/local/bin is (likely) not your home directory. sudo can't find sakis3g in the current directory because there is no such file.
Use /usr/local/bin/sakis3g instead of ./sakis3g.
copy that saskis3g object file in your directory where you have your code then you can use the command directly without including any file path for the object file(i.e sakis3g) in your connect command.
if suppose you have a folder named sample. and your program resides in this folder then copy+paste the sakis3g object file to this folder[you can do this by using the CP command in linux ] and use the normal command ie " system("sudo ./sakis3g connect"); " no need of any path.
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....
There are a few other questions on Stack Overflow about this and I do understand that, but none of them are giving me an idea of why im getting the "Could not open input file".
I have it setup so I get an email everytime a crons runs (im using cPanal to set the crons) but all I get is:
Could not open input file: /home/methodjs/classified/emailNotifications.php
Because is the first time i'm using crons jobs I have no idea what this means or how fix it.
My command line is:
/usr/local/bin/php $HOME/classified/emailNotifications.php
Am I doing something wrong? Thanks for any help. By the way, i'm sure thats the right path to PHP because thats what I got from my host.
ensure file is located here:
/home/methodjs/classified/emailNotifications.php
try to execute from commandline:
/usr/local/bin/php /home/methodjs/classified/emailNotifications.php
what appears?
ensure your php file has execution rights
chmod 755 /home/methodjs/classified/emailNotifications.php
The error appears either file is not present at given path or proper permission are not set for file. It can be checked by navigating to path and ll for checking permission.
All,
This problem started occurring on all my 20 Kubuntu machines after an update from Ubuntu! Since Ubuntu is Debian based not sure if Debian or Ubuntu is to blame, so investigating!
Debian users, if this is also impacting you please reply so we can investigate further!
Cheers!
I am trying to compile ARM code on Ubuntu 12.04 (Precise Pangolin).
Everything is working fine when I put the code in the local directory.
But when I put the code in the cited mount directory, an error shows up:
making testXmlFiles
sh: 0: getcwd() failed: No such file or directory
ARM Compiling xxxxx.c
sh: 0: getcwd() failed: No such file or directory
Here is my setting in fstab:
//10.0.0.1/data /mnt/data cifs auto,noserverino,credentials=/root/.smbcredentials,file_mode=0777,dir_mode=0777,uid=user,gid=users,noperm 0 0
What is going on here? What could cause this error?
This error is usually caused by running a command from a directory that no longer exists.
Try changing your directory and rerun the command.
That also happened to me on a recreated directory. The directory is the same, but to make it work again, just run:
cd .
Try the following command. It worked for me.
cd; cd -
This can happen with symbolic links sometimes. If you experience this issue and you know you are in an existing directory, but your symbolic link may have changed, you can use this command:
cd $(pwd)
In Ubuntu 16.04.3 LTS (Xenial Xerus), the following command works for me:
exit
Then I've login again.
Please check whether the directory path exists or not. This error comes up if the folder doesn't exist from where you are running the command.
Probably you have executed a remove command from the same path on the command line.
If some directory/folder does not exist, but somehow you navigated to that directory, in that case you can see this error.
For example:
currently, you are in the "mno" directory (path = abc/def/ghi/jkl/mno
run "sudo su" and delete mno
go to the "ghi" directory and delete the "jkl" directory
now you are in the "ghi" directory (path abc/def/ghi)
run "exit"
after running the "exit", you will get that error
now you will be in "mno"(path = abc/def/ghi/jkl/mno) folder. That does not exist.
So, generally this error will show when the directory doesn't exist.
To fix this, simply run "cd;" or you can move to any other directory which exists.
In my case, none of the previous answers has worked.
After banging my head against the wall for a while I've found out, that I've destroyed the /etc/passwd entries by running a custom-made-linux-server-setup-bash-script which worked well previously, but this time the regex within the "sed" command erased all the existing entries :D
After copy pasting the default entries from another working Linux server, I could finally restart sshd.
So don't forget to back up the original /etc/passwd file before applying any regular expression replacements on it :)