UNIX concepts: Difference between revisions

From Elvanör's Technical Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 12: Line 12:
* The default umask is the default set of permissions that files your current user will create will get. You can set it via the umask command (running this command without arguments gives you the current umask).
* The default umask is the default set of permissions that files your current user will create will get. You can set it via the umask command (running this command without arguments gives you the current umask).
* Note that the default umask (as well as the active group) is an environment setting. It is inherited by the parent process that spawned the current process.
* Note that the default umask (as well as the active group) is an environment setting. It is inherited by the parent process that spawned the current process.
= .a, .so, and .la files =
* Shared library are .so files; they dynamically link to other libraries if needed. I think .a files are libraries that do not link to other libraries (eg, statically compiled).
* .la files are just header files needed for gcc to compile against a .a file. These files are just plain text files that do not contain any code. In Gentoo those files should be avoided (if possible, all libraries should be compiled as .so files).


= Sticky bits =
= Sticky bits =

Revision as of 17:00, 23 August 2009

Default group

  • You can change the default active group of your user via the newgrp command. This will open a new shell so is not always convenient. This is why using sudo is sometimes mandatory when you want to run a command as an user with a different group.
  • sg allows you to do like newgrp but with a single command that will be ran as a different active group. UPDATE: this command is apparently not standard. On Gentoo it is a simple symlink to newgrp.

setgid

  • Any file created in a directory with this flag set will be created with the group of the directory, not the usual normal group.

umask

  • The default umask is the default set of permissions that files your current user will create will get. You can set it via the umask command (running this command without arguments gives you the current umask).
  • Note that the default umask (as well as the active group) is an environment setting. It is inherited by the parent process that spawned the current process.

.a, .so, and .la files

  • Shared library are .so files; they dynamically link to other libraries if needed. I think .a files are libraries that do not link to other libraries (eg, statically compiled).
  • .la files are just header files needed for gcc to compile against a .a file. These files are just plain text files that do not contain any code. In Gentoo those files should be avoided (if possible, all libraries should be compiled as .so files).

Sticky bits

  • If a directory has the sticky bit in its permissions, this means that all its files can be deleted only by their owners.
  • The "/tmp" directory has this sticky bit, this means you cannot delete files in /tmp belonging to another user, even if you are in the same group.