Chmod invalid command, Ubuntu server

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?

Replay

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

See 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

Don't use -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

Category: 14.04 Time: 2016-07-31 Views: 3

Related post

iOS development

Android development

Python development

JAVA development

Development language

PHP development

Ruby development

search

Front-end development

Database

development tools

Open Platform

Javascript development

.NET development

cloud computing

server

Copyright (C) avrocks.com, All Rights Reserved.

processed in 0.157 (s). 12 q(s)