Setting UID/GID for file/folder

When setuid (set-user identification) permission is set on an executable file or any ile, a process that runs this file is granted access based on the owner of the file (usually root), rather than the user who created the process. This permission enables a user to access files and directories that are normally available only to the owner.

The setuid permission is shown as an "s" in the file permissions.
# ls -l
-rw-r--r-- 1 admin other 54 Aug 8 01:43 pss.sh
# chmod 4554 pss.sh
#ls -l pss.sh
-r-sr-xr-- 1 admin other 54 Aug 8 01:43 pss.sh
You setuid permissions by using the chmod command to assign the octal value 4 as the first number in a series of four octal values

setgid Permission :
The setgid (set-group identification) permission is similar to setuid, except that the effective group ID for the process is changed to the group owner of the file and a user is granted access based on permissions granted to that group. The pss.sh program has setgid permissions:

# chmod 2554 pss.sh
# ls -l
-r-xr-sr-- 1 admin other 54 Aug 8 01:43 pss.sh
You can set setgid permissions by using the chmod command to assign the octal value 2 as the first number in a series of four octal values.

If you need to use both UID and GID on same file.follow below
# chmod 4554 pss.sh
# chmod g+s pss.sh
# ls -l
-r-sr-sr-- 1 admin other 54 Aug 8 01:43 pss.sh

Both files are enabled for UID/GID.

How to know which file belongs to solaris pkg

Determine Which Package a Particular File Belongs To - (Sun Solaris)
Use the pkgchk command, which package a particular file belongs to.

The syntax is:
# /usr/sbin/pkgchk -l -p /absolute/path/todir

For example,
# pkgchk -l -p /usr/bin/uuencode
Pathname: /usr/bin/uuencode
Type: regular file
Expected mode: 0555
Expected owner: root
Expected group: uucp
Expected file size (bytes): 6880
Expected sum(1) of contents: 43674
Expected last modification: Jan 05 06:51:49 PM 2000
Referenced by the following packages:
        SUNWesu
Current status: installed


[ OR ]

You can also simply query the packages as follows:

# grep /usr/bin/uuencode /var/sadm/install/contents
/usr/bin/uuencode f none 0555 root uucp 6880 43674 947116309 SUNWesu

unix shell differences

This table below lists most features that I think would make you
choose one shell over another. It is not intended to be a definitive
list and does not include every single possible feature for every
single possible shell. A feature is only considered to be in a shell
if in the version that comes with the operating system, or if it is
available as compiled directly from the standard distribution. In
particular the C shell specified below is that available on SUNOS 4.*,
a considerable number of vendors now ship either tcsh or their own
enhanced C shell instead (they don't always make it obvious that they
are shipping tcsh.

Code:


sh csh ksh bash tcsh zsh rc
es













Job control N Y Y Y Y Y N
N













Aliases N Y Y Y Y Y N
N













Shell functions Y(1) N Y Y N Y Y
Y













"Sensible" Input/Output redirection Y N Y Y N Y Y
Y













Directory stack N Y Y Y Y Y F
F













Command history N Y Y Y Y Y L
L













Command line editing N N Y Y Y Y L
L













Vi Command line editing N N Y Y Y(3) Y L
L













Emacs Command line editing N N Y Y Y Y L
L













Rebindable Command line editing N N N Y Y Y L
L













User name look up N Y Y Y Y Y L
L













Login/Logout watching N N N N Y Y F
F













Filename completion N Y(1) Y Y Y Y L
L













Username completion N Y(2) Y Y Y Y L
L













Hostname completion N Y(2) Y Y Y Y L
L













History completion N N N Y Y Y L
L













Fully programmable Completion N N N N Y Y N
N













Mh Mailbox completion N N N N(4) N(6) N(6) N
N













Co Processes N N Y N N Y N
N













Builtin artithmetic evaluation N Y Y Y Y Y N
N













Can follow symbolic links invisibly N N Y Y Y Y N
N













Periodic command execution N N N N Y Y N
N













Custom Prompt (easily) N N Y Y Y Y Y
Y













Sun Keyboard Hack N N N N N Y N
N













Spelling Correction N N N N Y Y N
N













Process Substitution N N N Y(2) N Y Y
Y













Underlying Syntax sh csh sh sh csh sh rc
rc













Freely Available N N N(5) Y Y Y Y
Y













Checks Mailbox N Y Y Y Y Y F
F













Tty Sanity Checking N N N N Y Y N
N













Can cope with large argument lists Y N Y Y Y Y Y
Y













Has non-interactive startup file N Y Y(7) Y(7) Y Y N
N













Has non-login startup file N Y Y(7) Y Y Y N
N













Can avoid user startup files N Y N Y N Y Y
Y













Can specify startup file N N Y Y N N N
N













Low level command redefinition N N N N N N N
Y













Has anonymous functions N N N N N N Y
Y













List Variables N Y Y N Y Y Y
Y













Full signal trap handling Y N Y Y N Y Y
Y













File no clobber ability N Y Y Y Y Y N
F













Local variables N N Y Y N Y Y
Y













Lexically scoped variables N N N N N N N
Y













Exceptions N N N N N N N
Y

Key to the table above.

Y Feature can be done using this shell.

N Feature is not present in the shell.

F Feature can only be done by using the shells function
mechanism.

L The readline library must be linked into the shell to enable
this Feature.


Notes to the table above



1. This feature was not in the orginal version, but has since become

almost standard.

2. This feature is fairly new and so is often not found on many

versions of the shell, it is gradually making its way into

standard distribution.

3. The Vi emulation of this shell is thought by many to be

incomplete.

4. This feature is not standard but unoffical patches exist to

perform this.

5. A version called 'pdksh' is freely available, but does not have

the full functionality of the AT&T version.

6. This can be done via the shells programmable completion mechanism.

7. Only by specifing a file via the ENV environment variable.


Calculate Your Swap Space

Multiply the Blocks column by 512
# swap -l
swapfile dev swaplo blocks free
/dev/dsk/c1t0d0s1 32,1 8 2104504 2104504
#

2104504 * 512 = 1077MB

check what shell you're running with

check what shell you're running
$ pargs $$

It reports current shell and previous shell