pg_upgrade oldbindir check fails - linux

I'm trying to upgrade postgresql database from 9.1 to 9.4. I ran the 9.4 version of pg_upgrade as follows:
sudo -u postgres pg_upgrade -b <path>/postgres/9.1/bin -B <path>/postgres/9.4/bin -d <path>/9.1DBs/ -D <path>/<empty folder>
I get:
check failed for: <path>/postgres/9.1/bin Permission denied
The folder exists, I set the permissions to 777, even gave the postgres user ownership of the directory structure, but I'm still getting the same error.
Running in verbose mode does not provide any extra info.
The partition with that contains the old binaries is mounted under /media/ and I have read/write access.
Any ideas what could be causing this?

This error
check failed for: /postgres/9.1/bin Permission denied
happens because access permission on directories (x bit) need to be set in every directory in the hierarchy, from the root to the directory containing these executables files.
This is detailed at Unix.SE in:
Do the parent directory's permissions matter when accessing a subdirectory?

Related

Unable to create / edit files as non-root through Samba mount

I'm trying to setup a code-server (vscode in browser) instance and read/write from a mounted samba share. Unfortunately when I try to add a file it gives me an error that I do not have permissions to read/write to that folder. When I try to add files with the same credentials on Windows it does work though. This is the error that VSCode gives me:
Unable to write file
'vscode-remote://localhost:8080/home/user/repository/test'
(NoPermissions (FileSystemError): Error: EACCES: permission denied,
open '/home/gmetitieri/user/test')
If I sudo touch file.txt then the file will be created and added. I already used chmod and added full access to the folder but it still won't work. Is this a credentials thing or am I missing something?
I already tried this answer but it still doesn't let me write as non-root
Edit: This is the command I used to mount the drive (just with different folder names and IP address):
sudo mount -t cifs -o rw,vers=3.0,credentials=/root/.examplecredentials //192.168.18.112/sharedDir /media/share
Considering "non-root through Samba", especially in new releases of OpenSuse (...15.3 -- 15.4), I do few movements into normal configuration panels (no sudo commands or anything technical).
Using Yast Firewall section -- For now (immediate solution):
I turn off the firewall, then see what you can turn on (after this) to keep the samba working with Microsoft Windows.
More details on how to do this with images on my website.
This happens when the directory on the Samba share does not have permission for non-root users.
In your smb4.conf file:
[test]
comment = Test share
path = /path/to/directory
force user = unixuser
valid users = sambauser
In this example, unixuser should be the owner of the files in /path/to/directory. The user logged into Samba in this example is a user called sambauser.

Permissions granted, still www-data cannot write files in folder

I have set up an Ubuntu server on Digital Ocean. Following are the config details:
Ubuntu version : Ubuntu 16.04.2 LTS
Apache version : Apache/2.4.18 (Ubuntu)
I am trying to run a php script through browser which will need to create a file in the directory . I keep getting the following permission denied message in the /var/log/apache2/error.log file fopen(<folder_to_write>): failed to open stream: Permission denied in test_write.php
I discovered that the user www-data (apache2 user) is having a permission issue. I changed the owner of the folder as follows :
chown -R www-data:www-data folder_to_write
and then
chmod 2775 folder_to_write
This did not work.
Finally, I tried the last option. I changed the directory permission to sudo chmod -R 777 folder_to_write hoping to get some lead. However, despite giving this full access permission, I got the permission denied message.
Has anyone experienced any such issue earlier? Not sure what I am doing wrong. I tried the same steps with another user and that seems to be working fine.
I appreciate your help. Thank you so much.
fopen(): failed to open stream:
It seems not able to find directory folder_to_write , Please check your absolute directory path if that's configured right for writing to a file.

Elasticsearch: Change permissions of old folder index to work with yum-installed elasticsearch

I used a specific library that used an embedded version of elasticsearch. Now as we are growing, I want to start elasticsearch as a service.
I followed this guide to install it using yum on a linux machine. I pointed ES to the new directory using
path:
logs: /home/ec2-user/.searchindex/logs
data: /home/ec2-user/.searchindex/data
When I start the service
sudo service elasticsearch start
I get a permission denied error:
java.io.FileNotFoundException: /home/ec2-user/.searchindex/logs/elasticsearch_index_search_slowlog.log (Permission denied)
at java.io.FileOutputStream.open0(Native Method)
....
I guess this has to do with the folder permission, I changed folder permission using:
sudo chown elasticsearch:elasticsearch -R .searchindex
But that didn't help.
Any help?
Your user elasticsearch can't write in the logging folder : /home/ec2-user/.searchindex/logs
Check the permissions with ls -l
Set write permission with the chmod command :e.g. : sudo chmod -R u+wx .searchindex
The issue occurred because .searchindex is located in ec2-user directory which obviously is inaccessible by elasticsearch user created to manage the elasticsearch service.
Moving the folder to /var/lib/elasticsearch did the trick.

process_usershare_file: stat of failed. Permission denied Samba

I created a shared folder using samba in ubuntu to enable windows machines can access it with the following command:
$ sudo net usershare add documents /home/developer/documents "Developer documents" everyone:F guest_ok=y
I give 777 permissions to the folder:
$ sudo chmod 0777 /home/developer/documents
And then I check what I've done
$ sudo net usershare info --long
When I want to see if the folder is visible from all windows machine, you can see. However, you cann't access that folder and get error of: "Permission Denied"
The message in: /var/log/samba/log.ip-domain is:
process_usershare_file: stat of /var/lib/samba/usershares/backuparsac failed. Permission denied
Then, I try to add some rules to my smb.conf
[documents]
comment = Documents for Developers
path = /home/developer/documents
browseable = yes
writable = yes
read only = yes
guest ok = yes
directory mask = 0777
but the error of Permission denied keeps coming. Is there anything else I need to do? I need this folder can be accessed by all windows machines.
NOTE: I use Ubuntu 14.04
The cause is that Samba does not synchronize its users with the system.
This solved the issue in my case, on Kubuntu 14.10:
sudo apt-get install libpam-smbpass
sudo service samba restart
If you don't want to synchronize users with PAM, simply add a user to Samba's password database:
sudo smbpasswd -a <user>
After that, the user will be able to open shared folders on the Samba machine.
Your configuration file seems to be fine.
I reckon there might be a permission issue in your parent folder.
I suggest you check /home and /home/developer both have 755 rather than 750 permission.
Then check sudo -u nobody ls /home/developer/documents.
If ls is successful, the samba is likely to work as you expected as well

Rsync mkdir permission denied

I am trying to use "Rsync" to copy my spark directory to all the slave machines by this command:
rsync -avL --progress /path/to/spark-0.9.0-incubating ubuntu#<Public_ip_of_slave>:/usr/local`
I am following the instructions on this site:
http://docs.sigmoidanalytics.com/index.php/Setup_hadoop_2.0.0-cdh4.2.0_and_spark_0.9.0_on_ubuntu_aws_cluster"
but I am facing an error which is permission denied to make the folders in the destination.
Can anyone help me?
The ubuntu user (which you are using for scp) does not have the appropriate directory permissions on /usr/local at the remote server.
Misconfiguration can result in security issues so changing the directory permission of /usr/local is not recommended. If you wish to do so run:
ssh ubuntu#remote-server 'sudo chown root:ubuntu /usr/local'
where remote-server is the hostname or IP of the remote server and assuming that ubuntu is an administrator. You may also allow all others to write to the directory:
ssh ubuntu#remote-server 'sudo chmod o+w /usr/local'
but this is more dangerous than the previous option.
Alternatively, you may copy it into your home directory first then issue a sudo command to move the files into /usr/local:
rsync -avL --progress /path/to/spark-0.9.0-incubating ubuntu#remote-server:~
ssh ubuntu#remote-server 'sudo mv ~/spark-0.9.0-incubating /usr/local'
~ will be expanded to the home directory of the user, which in this case is likely to be /home/ubuntu/.
Do remember to change the permissions of /usr/local/spark-0.9.0-incubating as appropriate to allow access to authorized users using the chmod command.

Resources