Error in Linux RHEL09 when switching to user after auto-fs service enabled - linux

Trying to set up nfs-share and auto-mount using autofs on RHEL 09
I am trying to auto-mount a user account on 172.16.10.10 from an exported directory /rhel/user1 on 172.16.10.20
the directory for the home user on 172.16.10.10 is /users/user1
I can set this up properly and create a user (user1) so that their home directory is /users/user1. I can check by su - user1 and pwd shows /users/user1
However, after configuring the autofs service in the two files
/etc/auto.master.d/user1.autofs >>>>>> /users /etc/auto.user1
/etc/auto.user1 >>> user1 -rw 172.16.10.20:/rhel/user1
then restart the service using >>> systemctl restart autofs
Then when I switch to that user >> su - user1
I get an error >>>> su: warning: cannot change directory to /users/user1: No such file or directory
This has worked in the past, but also this service will often give this error. A bunch of people in my class have got this error, and now I'm getting this. Please help!
I've tried checking and changing the directory permissions to the /users directory, but this has not worked. I've reverted back to snap-shots again and again, but this has not helped

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.

Linux: Apache can not delete file despite of sufficient permissions

PHP script uploads archives on the web server and unzip them. Under some conditions I need to delete previously unzipped files. But apache can not delete the files because it get "Access denied" error despite of it has all the necessary permissions. I tried to delete them as 'apache' user manually and got the same error.
For example:
# ls -l
....
-rw-r--r--. 1 apache apache 46 янв 26 11:11 desktop.ini
# sudo -u apache rm desktop.ini
rm: невозможно удалить «desktop.ini»: Отказано в доступе
^^^ It means Access Denied
I can delete the files as 'root' user.
I thought that it can be by selinux restrictions. But selinux works in permissive mode:
# getenforce
Permissive
make sure that the apache service is indeed running as username 'apache' as it is typically running as username 'www-data' however I am sure you most likely have checked this already.
the user 'apache' only has write/read permissions in your above post
however to delete a file you need write/execute permissions
give the user execute permissions

failed to start jboss service with non root user

I tried to start jobs service with non root user and group but I received runuser cannot set groups operation not permitted jobs error in /var/log/jboss-as/console.log. I installed and configured jboss service with non root user. It worked fine with root, but failed to start/stop/restart jboss service with non root user. I have no ideas why this happened.
give permissions to the folder like
chmod 775 -R

CentOS 7 Symfony 2 Unable to create the cache directory Issue [duplicate]

I've downloaded 2.0.4... I can't get pass the "can't create cache directory" cause of permissions problem...
I've tried chmod 777 -R symfony
-- to all folders, still can't create cache dir
I've tried setfacl but it says unrecognized -m option....
My system does not support chmod +a
I've done chown -R myuser:apache symfony
-- still nothing
I've tried umask(0000) and umask(0002) in console.php/app_dev.php/app.php
-- still nothing
When I refresh the page to http://localhost/symfony/web/app_dev.php, I get a SElinux alert... is this causing something? I'm not sure... all symfony content is word writable.
I'm not sure if it's me... but it's driving me nuts, maybe I just should stop using symfony2.
I'm using Fedora 13.
It seems that you will need to switch SELinux to Permissive state. You can do so executing as root user:
setenforce 0
PHP's umask may have no effect when default apache umask is different.
Originally I used to use setfact, but this adds overhead for deployment.
What worked for me on ubuntu servers is:
Set default apache umask.
Edit /etc/apache2/envvars and add this line in the end of file:
umask 0002
Reload apache service
Add your deploy user to www-data group, add www-data to your deploy user group.
adduser www-data `whoami`
adduser `whoami` www-data
Logout or restart server for this to take effect.
Remove app/cache, app/logs dirs
Try to load page in browser, notice how app/cache dir is created by www-data user and has write group permission. Try to clear cache in console and verify that no errors occurred.
Remove app/cache, app/logs dirs
Run cache:clear, notice how app/cache dir is created by user deploy user and has write group permission. Try to load page in browser, and verify that no errors occurred.
Now you can forget about cache and logs permissions on this particular server for all subsequent projects.

Can't change to home directory

When logging into my virtual server as a non-root user, I suddenly get the following error:
"Could not chdir to home directory
/var/www/vhosts/prosodylab.org/web_users/username: Permission denied
-bash: /var/www/vhosts/prosodylab.org/web_users/username/.bash_profile:
Permission denied"
I checked the permissions in the user directory (they're set to 700, and I also changed to 777 to check, with now effect).
This affects all users (including if I create a new user), but as root user I can still change into the relevant directories without problem.
echo $HOME returns the right directory.
Here is the directory entry of the home directory of the user (when set to 700):
drwx------ 20 username psaserv 4096 Jun 5 16:56 username
grep username /etc/passwd returns the following output, so the directory seems to be set correctly:
username:x: [...] ::/var/www/vhosts/prosodylab.org/web_users/username:/bin/bash
The server is a 1&1 dedicated virtual linux server, and it's worked fine for many years. I might have inadvertently changed something, but if so the I don't know what.
Does anyone know what might be the problem?
Gain more access login as root and check the permissions on the parent folder

Resources