sudo is available from the SFWsudo package on Solaris 10.
To use it a /etc/sudoers file has been set but still leading to the following error
user NOT in sudoers
Hopefully, truss will help :-)
root@server:/# truss -o /tmp/output sudo ls
The /tmp/output file is answering the enigma:
root@server:/# grep sudoers /tmp/output
lstat("/opt/sfw/etc/sudoers", 0xFFBFFB28) = 0
open("/opt/sfw/etc/sudoers", O_RDONLY) = 4
The sudoers file to edit is in /opt/sfw/etc
22 August 2008
01 July 2008
Raw devices & Block devices
Most of the people will get confused when to use /dev/dsk/c0t1d0s7 and /dev/rdsk/c0t1d0s7 device files.
Generally /dev/dsk is a block disk device whereas /dev/rdsk is a character disk device
As a thumb rule raw devices are used before filesystem creation.Block devices are user after filesystem creation.
E.g., In Solaris whenever you create a new slice using format command a raw physical slice or a Raw Device will be created which is addressed as /dev/rdsk/c#t#d#s#
After formatting it with newfs command the slice will be addressed as /dev/dsk/c#t#d#s# which can now be used for mounting.
newfs /dev/rdsk/c0t1d0s4
mkdir /oracle
mount /dev/dsk/c0t1d0s4 /oracle
After mounting /dev/dsk/c#t#d#s# is called as Block Device
Generally /dev/dsk is a block disk device whereas /dev/rdsk is a character disk device
As a thumb rule raw devices are used before filesystem creation.Block devices are user after filesystem creation.
E.g., In Solaris whenever you create a new slice using format command a raw physical slice or a Raw Device will be created which is addressed as /dev/rdsk/c#t#d#s#
After formatting it with newfs command the slice will be addressed as /dev/dsk/c#t#d#s# which can now be used for mounting.
newfs /dev/rdsk/c0t1d0s4
mkdir /oracle
mount /dev/dsk/c0t1d0s4 /oracle
After mounting /dev/dsk/c#t#d#s# is called as Block Device
29 May 2008
Soft limit & Hard limit
Most of us encountered to increase the limit of file descriptors while installing a high end 3pp(party product).In doing so we will encounter with two different kinds of limits i.e.soft vs hard.
Hard limits are a kernel-configurable item and users can't exceed them. Soft limits are the user defaults and users can change that using the ulimit command.
Basically, soft limits can be changed to anything up to the hard limit. Soft limits are warning barrier. When a user reaches the soft limit they will get an warning message but are still allowed to use more space up to the hard limit.
Since its a kernel tunable we have to define the value in /etc/system and /etc/sysctl.conf for Pre-Solaris 10 and Linux respectively.
E.g.,
To set a hard limit of 4096 and soft limit of 1024 in Solaris 8.
set rlim_fd_max=4096 [Refers Hard limit]
set rlim_fd_cur=1024 [Refers Soft limit]
To raise the allowed limit in Linux based distributions update either /etc/limits.conf or /etc/security/limits.conf
Hard limits are a kernel-configurable item and users can't exceed them. Soft limits are the user defaults and users can change that using the ulimit command.
Basically, soft limits can be changed to anything up to the hard limit. Soft limits are warning barrier. When a user reaches the soft limit they will get an warning message but are still allowed to use more space up to the hard limit.
Since its a kernel tunable we have to define the value in /etc/system and /etc/sysctl.conf for Pre-Solaris 10 and Linux respectively.
E.g.,
To set a hard limit of 4096 and soft limit of 1024 in Solaris 8.
set rlim_fd_max=4096 [Refers Hard limit]
set rlim_fd_cur=1024 [Refers Soft limit]
To raise the allowed limit in Linux based distributions update either /etc/limits.conf or /etc/security/limits.conf
07 March 2008
How to Password Protect GRUB Boot loader
The main reason to password protect the GRUB boot loder is to prevent access to single user mode — If attackers can boot the system into single user mode, they are logged in automatically as root without being prompted for the root password.
To do this, open a shell prompt, log in as root, and type:
/sbin/grub-md5-crypt
When prompted, type the GRUB password and press Enter. This returns an MD5 hash of the password.
Next, edit the GRUB configuration file /boot/grub/grub.conf. Open the file and below the timeout line in the main section of the document, add the following line:
password --md5
Replacewith the value returned by /sbin/grub-md5-crypt
To do this, open a shell prompt, log in as root, and type:
/sbin/grub-md5-crypt
When prompted, type the GRUB password and press Enter. This returns an MD5 hash of the password.
Next, edit the GRUB configuration file /boot/grub/grub.conf. Open the file and below the timeout line in the main section of the document, add the following line:
password --md5
Replace
Relative vs. Absolute Pathnames
Commands can be given file name arguments in two ways.
If you are in the same directory as the file (i.e., the file is in the current directory), then you can just enter the file name on its own (e.g., cp my_file new_file). Otherwise, you can enter the full path name, like cp /home/john/my_file /home/jack/new_file.
Very often administrators use the notation ./my_file to be clear about the distinction, for instance, cp ./my_file ./new_file. The leading ./ makes it clear that both files are relative to the current directory.
File names not starting with a / are called relative path names, and otherwise, absolute path names.
If you are in the same directory as the file (i.e., the file is in the current directory), then you can just enter the file name on its own (e.g., cp my_file new_file). Otherwise, you can enter the full path name, like cp /home/john/my_file /home/jack/new_file.
Very often administrators use the notation ./my_file to be clear about the distinction, for instance, cp ./my_file ./new_file. The leading ./ makes it clear that both files are relative to the current directory.
File names not starting with a / are called relative path names, and otherwise, absolute path names.
26 February 2008
Steps to Configure IP for MP-Port in HP Servers
Step 1: Connect a terminal to the console port of the system.
Step 2: Login tothe console using username and password. The default username for MP is typically Admin and the default
password is Admin.
Enter parameter(s) to change, A to modify All, or [Q] to Quit:
Step 5: Type the IP address of the MP port.
Web Console Port Number:
Current -> 2023 (default)
Options: 23, 2000 to 2400
->Current Web Console Port Number has been retained
Console Port Number has been retained
Link State :
Current -> A - Auto Negotiate (default)
T - 10BaseT
->Current Link State has been retained
Step 2: Login tothe console using username and password. The default username for MP is typically Admin and the default
password is Admin.
Step 3: Type “cm” on the MP prompt to go to the MP command menu
Step 4: Type “lc” on the MP CM prompt to modify the LAN configuration and press “A” when prompted for modificationCurrent LAN Configuration:
- - MAC Address : 0x001635b66433
D - DHCP Status : Disabled
I - IP Address : ---------------
M - MP Host Name: ---------------
S - Subnet Mask : ---------------
G - Gateway Address : ------------
L -Link State : Auto Negotiate
W -Web Console Port Number : 2023
- - SSH Access Port Number : - (MP Feature Not Licensed)
- - IPMI /LAN Port Number : 623A
- - MAC Address : 0x001635b66433
D - DHCP Status : Disabled
I - IP Address : ---------------
M - MP Host Name: ---------------
S - Subnet Mask : ---------------
G - Gateway Address : ------------
L -
W -
- - SSH Access Port Number : - (MP Feature Not Licensed)
- - IPMI /
Enter parameter(s) to change, A to modify All, or [Q] to Quit:
IP Address:
Current ->
127.0.0.1 (default)
Current ->
127.0.0.1 (default)
Modifying this parameter will cause all present LAN and Web connections to be dropped.
Enter new value, or Q to Quit: 172.16.1.100
Step 6: Type the hostname of the MP port.
Host Name:
Current ->
mp001635b66433 (default)
Current ->
mp001635b66433 (default)
Enter new value, or Q to Quit: m1sys100
Step 7: Type the Subnet Mask of the MP port.
Subnet Mask:
Current ->
255.255.255.0 (default)
Current ->
255.255.255.0 (default)
Modifying this parameter will cause all present LAN and Web connections to be dropped.
Enter new value, or Q to Quit: 255.255.224.0
Step 8: Type the Gateway of the MP port.
Gateway Address:
Current ->
127.0.0.1 (default)
Current ->
127.0.0.1 (default)
Enter new value, or Q to Quit: 172.16.0.1
Step 9: Press “Enter” when prompted for Web Console Port Number.
Current -> 2023 (default)
Options: 23, 2000 to 2400
Modifying Web Port number will cause all present Web connections to be dropped.
Enter new value, or Q to Quit:
->
Step 10: Press “Enter” when prompted for SSH Console Port Number.
SSH Console Port Number:
Current -> 22 (default)
Options: 22, 2000 to 2400
Current -> 22 (default)
Options: 22, 2000 to 2400
Enter new value, or Q to Quit:
-> Current SSH Step 11: Type “Disabled” or “D” when prompted for DHCP Status.
DHCP Status:
Current -> D - Disabled
E - Enabled (default)
Modifying this parameter will cause all present LAN and Web connections to be dropped.
Current -> D - Disabled
E - Enabled (default)
Modifying this parameter will cause all present LAN and Web connections to be dropped.
Enter new value, or Q to Quit: Disabled
Step 12: Press “Enter” when prompted forLink State .
Step 12: Press “Enter” when prompted for
Current -> A - Auto Negotiate (default)
T - 10BaseT
Modifying this parameter will cause all present LAN and Web connections to be dropped.
Enter new value, or Q to Quit:
->
Step 13: Type “xd” on the MP CM prompt and press “r” to reset MP.
Step 14: From any of the lab machines, ping to the newly configured IP address of the GSP and see if it is alive on the
network.
network.
21 February 2008
How to Make USB Pen drive as a bootable device (RedHat)
If you cannot boot from the DVD/CD-ROM drive, but you can boot using a USB device, such as a USB pen drive, the following alternative boot method is available:
To boot using a USB pen drive, use the dd command to copy the diskboot.img image file from the /images/ directory on the DVD or CD-ROM. For example:
dd if=diskboot.img of=/dev/sda
Note: Your BIOS must support booting from a USB device in order for this boot method to work
To boot using a USB pen drive, use the dd command to copy the diskboot.img image file from the /images/ directory on the DVD or CD-ROM. For example:
dd if=diskboot.img of=/dev/sda
Note: Your BIOS must support booting from a USB device in order for this boot method to work
14 February 2008
What is umask in Linux/Unix?
The User file-creation mode mask (umask) is use to determine the file permission for newly created files. It can be used to control the default file permission for new files. It is a four-digit octal number .
Default umask for normal user is 0002.
Default umask for root user is 0022.
Default base permission for directories & files are 0777 (rwxrwxrwx) & 0666 (rw-rw-rw-) respectively.
To calculate directory permission for root user
Default Permissions : 777
Subtract umask value: 022 (-)
Allowed Permissions : 755
To calculate file permission for root user
Default Permissions : 666
Subtract umask value: 022 (-)
Allowed Permissions : 644
The following example explains the steps needed to set umask for permissions 700 for user files. The idea very simply only user is allowed to read or write file.
Default Permissions: 777
Subtract umask value: 077 (-)
Allowed Permissions: 700
Output:
Default umask for normal user is 0002.
Default umask for root user is 0022.
Default base permission for directories & files are 0777 (rwxrwxrwx) & 0666 (rw-rw-rw-) respectively.
To calculate directory permission for root user
Default Permissions : 777
Subtract umask value: 022 (-)
Allowed Permissions : 755
To calculate file permission for root user
Default Permissions : 666
Subtract umask value: 022 (-)
Allowed Permissions : 644
The following example explains the steps needed to set umask for permissions 700 for user files. The idea very simply only user is allowed to read or write file.
Default Permissions: 777
Subtract umask value: 077 (-)
Allowed Permissions: 700
$ umask 077
$ touch file.txt
$ ls -l file.txtOutput:
-rw------- 1 demo demo 0 2008-10-10 12:21 demo.txt
12 February 2008
Procedure to configure IP for GSP Port in HP-PA Server Models
Step 1: Connect a terminal to the console port of the system.
Step 2: Login to the console using username and password. The default username for GSP is typically root and the default password is root.
Step 3: Press Ctrl+B to go to the GSP prompt. Sometimes, it is required to press Ctrl+Ecf to get write access to the console.
Step 2: Login to the console using username and password. The default username for GSP is typically root and the default password is root.
Step 4: Type “lc” on the GSP prompt to modify the IP configuration and press “Y” when prompted for modification
Current configuration:
MAC Address : 0x00110a417c09
IP Address : --------------
GSP Host Name : --------------
Subnet Mask : --------------
Gateway : --------------
Do you want to modify the LAN configuration? (Y/[N]): y
Step 5: Press “Y” when prompted to modify the Current IP Address.
Current IP Address:
Do you want to modify it? (Y/[N]): y
Step 6: Type the IP address of the GSP port and press “Y” to confirm.
New IP Address: 172.16.1.100
Confirm? (Y/[N]): y
Step 7: Press “Y” when prompted to modify the current GSP Host Name.
Current GSP Host Name:
Do you want to modify it? (Y/[N]): y
Step 8: Type the hostname of the GSP port and press “Y” to confirm
New GSP Host Name: m1sys100
Confirm? (Y/[N]): y
Step 9: Press “Y” when prompted to modify the current Subnet Mask.
Current Subnet Mask:
Do you want to modify it? (Y/[N]): y
Step 10: Type the subnet mask of the GSP port and press “Y” to confirm
Enter new Subnet Mask: 255.255.224.0
Confirm? (Y/[N]): y
Step 11: Press “Y” when prompted to modify the current Gateway.
Current Gateway:
Do you want to modify it? (Y/[N]): y
Step 12: Type the gateway of the GSP port and press “Y” to confirm.
Enter New Gateway: 172.16.0.1
Confirm? (Y/[N]): y
Step 13: Press “n” when prompted to modify the current Web Console Port.
Modifying Web Port number will cause all present Web
connections to be dropped.
Do you want to modify it? (Y/[N]): n
-> Reset the GSP for LAN configuration to take effect.
-> Use the R option of the XD command to reset the GSP
Step 14: Type “xd” at the GSP prompt and press “r” to reset the GSP.
Step 15: From any of the lab machines, ping to the newly configured IP address of the GSP and see if it is alive on the network.
Subscribe to:
Posts (Atom)