I am trying to give the user tomcat8 write and read access to a specific folder on my server. I tried this command:
sudo chmod -R tomcat8 /usr/local/javaagent/appagent/ver2/logs/Tomcat1
However it gives me "chmod: invalid mode: `tomcat8'". Why doesn't this work? Isn't this the standard chmod?
If you don't want to give other users permission to change files here, you should make a group for tomcat8 and change the group ownership of the directory.
sudo groupadd tomcat && sudo adduser tomcat8 tomcat
You may also want to add yourself to the group with
sudo adduser username tomcat. Also add any other users who need read write access here.
Now change the group ownership of the directory
sudo chown :tomcat /usr/local/javaagent/appagent/ver2/logs/Tomcat1
Don't forget the colon - this changes only the group ownership.
Now change permissions, for example:
sudo chmod g+rw /usr/local/javaagent/appagent/ver2/logs/Tomcat1
man chmod here - from your question I'm not sure what you want the other settings to be. Directories need execute permission to be openable and searchable, so you most likely want octal 775 (so all users can read and search but only group can write) or 770 (so only owner and group have any permissions)
Check permissions to see if it is what you want:
ls -ld /usr/local/javaagent/appagent/ver2/logs/Tomcat1
-R as it's unlikely you want all files to have execute permission.
You probably do want to add the setgid bit though, so that files created here by all users inherit the same group ownership as the directory:
chmod g+s /usr/local/javaagent/appagent/ver2/logs/Tomcat1