User in wheel group can't cd into public_html folders
Hi,
Since some cli (like wp and composer) are not recommended being ran as root, I tried creating a sudo user and added it to wheel group. Furthermore, I have followed the article here - . The problem is -
I can sudo ls -la /root, I can cd until /home/users'_home_directories but I cannot cd into public_html directories inside users' home directories. I tried searching on the web with several keywords and no issue like me was found. An answer on serverfault (
-
Hello, Since you have added a sudo user. Edit /etc/sudoers and add the following entry under root. sudo_user_name ALL=(ALL) NOPASSWD: ALL (add you sudo user name instead of sudo_user_name). Then login to your server and run comand :- sudo su - Do have a try. 0 -
Then login to your server and run comand :- sudo su -
sudo su -
just switched the user to root which I don't want because some commands are not recommended to run as root. Please see below the message when I runwp
as root[wheel_user@server cpanel_user]$ sudo su - Last login: Sat Aug 15 03:57:49 UTC 2020 on pts/1 Last failed login: Sat Aug 15 03:58:22 UTC 2020 from 119.45.40.87 on ssh:notty There was 1 failed login attempt since the last successful login. [root@server ~]# wp Error: YIKES! It looks like you're running this as root. You probably meant to run this as the user that your WordPress installation exists under. If you REALLY mean to run this as root, we won't stop you, but just bear in mind that any code on this site will then have full control of your server, making it quite DANGEROUS. If you'd like to continue as root, please run this again, adding this flag: --allow-root If you'd like to run it as the user that this site is under, you can run the following to become the respective user: sudo -u USER -i -- wp [root@server ~]#
0 -
Hello, Based on what you've shown this is the standard behavior for a wheel user. It has sudo privileges and by default no one should be able to get a directory listing without either being the user which owns the file, being the root user or using sudo to escalate 0 -
or using sudo to escalate
In fact, listing directories isn't my main goal. The main goal here is to cd into each user's directory and run commands likewp
andcomposer
but according to your reply it isn't possible without any risk except for the user account itself?0 -
The method that you have used seems to be correct. I just now tried to replicate it, and it worked just fine. I am not sure if there is a typo, but there is a slight problem with the command. There is no need to have "mygroup" mentioned in there. The following works # chmod -R g+swrx /mount/abc Even, you can remove the s bit, just do g+rwx. After you have changed the permissions, and you do ls -l, it should display the relevant privileges. 34522 silver badges77 bronze badges - 2 I removed the typo with the groupname. The directory has the wrx permissions on it when you do ls -l, and it is owned by nobody:mygroup. Even though myuser is part of mygroup, myuser still cannot create/delete files. I hope that makes sense.
0 -
I found out a way and I am sharing it for future visitors. As my main goal is to running the commands I mentioned without having to logout and login to different user with SSH, I use the root account to do usual tasks. When it comes to situation to use those commands that doesn't recommend running as root, I switched to the cpanel user in the same terminal by typing su - cpanelusername
. In that way, I can run the commands as non-root and don't have to log out and login.0
Please sign in to leave a comment.
Comments
6 comments