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?