4

I started off with changing to the folder I want to change permissions for, and that is the opt folder.

$ cd /opt/
test@testVM:/opt$

So I tried changing the permissions for this folder now using:

sudo chmod 775

And that hasn't worked. It showed this message:

Try 'chmod --help' for more information.

There is something I am forgetting or leaving out.

Please can you show me what I am doing wrong?

Thanks in advance.

3 Answers 3

11

You forgot the "change what" part of the command.

Most commands are like a simple "verb-noun" type structure. (Which, if you think about it, tends to explain why we sound like Yoda when we talk)

You said "chmod 755"... which is the verb... where's the noun?

sudo chmod 755 .         # the '.' means 'here'

-or-

sudo chmod 755 /opt      # always better to specify exactly what you want

My question is going to be: Why do you want to do that? What need do you have to change the permissions of /opt? (not that it's vitally important for me to know, but you should know that changing permissions of anything that's not in your /home folder is usually not a good idea. Think about what you're doing.)

2
  • I am using a program called WinSCP (like an FTP server) to copy files from my local machine to the Ubuntu machine (VM), and need to have the permissions to copy to that folder. Everytime I try copying a folder across, it says the following: "scp: /opt/{folder name}: Permission denied"
    – Kevdog777
    Jul 10, 2012 at 9:28
  • 2
    No worries, but 755 isn't going to allow you to write in that subdirectory either. Why not create a subdirectory in your home and have it saved there? It's your system, do as you wish.
    – lornix
    Jul 10, 2012 at 9:30
1

You need to specify directory in arguments. If you want to apply changes to the current directory, just add . at the end (or even the full path):

sudo chmod 775 .

otherwise it will give you the error.

ps. If you ran chmod --help as suggested, you would have seen:

 $ chmod --help
Usage:  chmod [OPTION]... MODE[,MODE]... FILE...
   or:  chmod [OPTION]... OCTAL-MODE FILE...
   or:  chmod [OPTION]... --reference=RFILE FILE...
0
0

sudo chmod 775 .

You can just do sudo chmod 775 /opt without cd.

Bye the way, -R option of chmod is recursively mode changing.

man chmod for more information.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .