The following is being executed from an account with sudo privileges:

I have a user tomcat created with the following command

sudo useradd -g tomcat -d /usr/local/tomcat -m -s /bin/false tomcat 

I also have a user test created with the following command

sudo adduser test 

I have a folder temp and perms 777 are set on this folder

chmod 777 temp 

Following are my observations:

## This works and I can see temp/a.txt being created sudo -u tomcat touch temp/a.txt ## Does not work. sudo su -c "touch temp/b.txt" tomcat ## works sudo -u test touch temp/c.txt ## works sudo su -c "touch temp/d.txt" test 

So my question is what exactly is wrong with tomcat user?

1 Answer

The tomcat's shell is /bin/false, you can run with su - as

sudo su -s /bin/bash -c "touch temp/b.txt" tomcat 
0

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy