chmod u+x
chmod u+x file adds the execute bit for the file's owner (u) and changes nothing else, so a 644 file becomes 744 and a 600 file becomes 700, whatever your umask is.
Results on common starting modes
| Before | After |
|---|---|
644 rw-r--r-- | 744 rwxr--r-- |
600 rw------- | 700 rwx------ |
664 rw-rw-r-- | 764 rwxrw-r-- |
640 rw-r----- | 740 rwxr----- |
444 r--r--r-- | 544 r-xr--r-- |
How the operator reads
A symbolic mode is who, operator, permissions. Who is any of u (the owner), g (the group), o (others) or a (all three). The operator is + to add, - to remove, or = to set exactly. Permissions are r, w, x, plus X, s and t.
Because u+x names its class explicitly, the umask plays no part: chmod only applies the umask filter when the who part is omitted, as in plain +x.
chmod u+x script.sh # owner may run it
chmod u+x,go-rwx script.sh # and nobody else may touch it (700)
chmod u-x script.sh # undoWhen owner-only execute is the point
Personal scripts in ~/bin, cron jobs that run as your user, and scripts that must not be started by colleagues by accident. Keep in mind that anyone who can read a script can still run it through its interpreter; if the source is sensitive, remove read for group and others too (chmod 700).
Frequently asked questions
- What does chmod u+x mean?
- u is the file owner, + adds, x is execute: give the owner permission to run the file, and leave every other bit as it is.
- What is the numeric equivalent of chmod u+x?
- There is none in general, because u+x is relative to the current mode. On a 644 file the result is 744; on 600 it is 700; on 664 it is 764.
- Is u+x affected by the umask?
- No. Only symbolic modes without a user list (like +x or -w) are filtered by the umask.
Last reviewed by Arielton Oberek.