Press e in when grub shows at boot time.
Edit multiboot line below and add -s to the end press enter
then b for boot
root (hd0,0,a)
kernel /platform/i86pc/multiboot -s
module /platform/i86pc/boot_archive
Or you can edit /boot/grub/menu.lst and add new entries like below copy your original entries in the file and add -s to end of multiboot line.
title Solaris 10 11/06 s10x_u3wos_10 X86
root (hd0,0,a)
kernel /platform/i86pc/multiboot -s
module /platform/i86pc/boot_archive
Thursday, 28 August 2008
Thursday, 21 August 2008
Secure port forwarding without shell access
My aim was connection to ssh deamon on defined port (4321 for this example) different then default port and specific users (only for theusername for this example) without shell access and permiting port forwarding. Chroot for sshd is painfull.
Create custum sshd config file
Changed options in sshd_config_custom file
With this configuration file, only theusername could connect ssh deamon on port 4321.
Run sshd deamon
Change shell to /usr/bin/false in passwd file
If you do not have false shell create read only shell.
Make executable
From remote computer:
So user had to use -N option for ssh command
For port forwarding from another system
-p for changed ssh port in sshd_config_custom
Now user could not give any command on the server but could port forward 9999 from the server to computer.
Create custum sshd config file
cp /etc/ssh/sshd_config /etc/sshsshd_config_custom
Changed options in sshd_config_custom file
Port 4321
PermitRootLogin no
AllowUsers theusername
With this configuration file, only theusername could connect ssh deamon on port 4321.
Run sshd deamon
/usr/lib/ssh/sshd -f /data01/tcell/sshd_config_config
Change shell to /usr/bin/false in passwd file
vi /etc/passwd
theusername:x:404:808::/homefolder:/bin/sh
theusername:x:404:808::/homefolder:/usr/bin/false
If you do not have false shell create read only shell.
vi /usr/bin/dummyshell
add two lines below
#!/bin/bash
bash -r -c read
Make executable
chmod a+x /usr/bin/dummyshell
From remote computer:
So user had to use -N option for ssh command
-N
Does not execute a remote command. This is useful if you
just want to forward ports (protocol version 2 only).
For port forwarding from another system
ssh -N theusername@ipadressoftheserver -L 9999:127.0.0.1:9999 -p 4321
-p for changed ssh port in sshd_config_custom
Now user could not give any command on the server but could port forward 9999 from the server to computer.
Friday, 15 August 2008
Shell script argument check and directory check
With this part you can check arguments are supplied and give usage information.
if [ $# -ne 2 ]
then
echo 1>&2 Usage: $0 firstdatafile lastdatafile
exit 127
fi
Create if directory does not exist
DESTDIR=dirname
if ! test -d "$DESTDIR"
then mkdir -p $DESTDIR
fi
if [ $# -ne 2 ]
then
echo 1>&2 Usage: $0 firstdatafile lastdatafile
exit 127
fi
Create if directory does not exist
DESTDIR=dirname
if ! test -d "$DESTDIR"
then mkdir -p $DESTDIR
fi
Tuesday, 12 August 2008
Relocating Oracle Data Files
Check for location
SQL> SELECT FILE_NAME, BYTES FROM DBA_DATA_FILES WHERE TABLESPACE_NAME = 'TABLESPACE';
FILE_NAME
--------------------------------------------------------------------------------
BYTES
----------
/dbfiles/oradata03/loc/FILE_DATA01.dbf
4294967296
Take tablespace offline
SQL> ALTER TABLESPACE FILE_DATA OFFLINE NORMAL;
Tablespace altered.
Copy file to the new location.
cp /dbfiles/oradata03/loc/FILE_DATA01.dbf /dbfiles/oradata05/loc/FILE_DATA01.dbf
Check for file permission and owner.
Do it for Oracle
SQL> ALTER TABLESPACE FILE_DATA RENAME DATAFILE '/dbfiles/oradata03/loc/FILE_DATA01.dbf' to '/dbfiles/oradata05/loc/FILE_DATA01.dbf';
Tablespace altered.
Take tablespace online
SQL> ALTER TABLESPACE FILE_DATA ONLINE;
Tablespace altered.
SQL> SELECT FILE_NAME, BYTES FROM DBA_DATA_FILES WHERE TABLESPACE_NAME = 'TABLESPACE';
FILE_NAME
--------------------------------------------------------------------------------
BYTES
----------
/dbfiles/oradata03/loc/FILE_DATA01.dbf
4294967296
Take tablespace offline
SQL> ALTER TABLESPACE FILE_DATA OFFLINE NORMAL;
Tablespace altered.
Copy file to the new location.
cp /dbfiles/oradata03/loc/FILE_DATA01.dbf /dbfiles/oradata05/loc/FILE_DATA01.dbf
Check for file permission and owner.
Do it for Oracle
SQL> ALTER TABLESPACE FILE_DATA RENAME DATAFILE '/dbfiles/oradata03/loc/FILE_DATA01.dbf' to '/dbfiles/oradata05/loc/FILE_DATA01.dbf';
Tablespace altered.
Take tablespace online
SQL> ALTER TABLESPACE FILE_DATA ONLINE;
Tablespace altered.
Monday, 11 August 2008
Solaris new disks from SAN
This commands help you to force configuration of new disks.
cfgadm -o force_update -c configure c3
Then you can run devfsadm or drvconfig
and later format and newfs.
Before
You can see that c3::50060e8004f35909 c2::50060e8004f35919 not configured.
Run cfgadm
cfgadm -o force_update -c configure c2
Now you can see c2::50060e8004f35919 configured. Do this also for c3
After that I can see disk in format menu. Change disk layout.
6. c4t60060E8004F359000000F35900000D1Ad0
/scsi_vhci/ssd@g60060e8004f359000000f35900000d1a
Create file system
newfs /dev/rdsk/c4t60060E8004F359000000F35900000D1Ad0s0
cfgadm -o force_update -c configure c3
Then you can run devfsadm or drvconfig
and later format and newfs.
Before
# cfgadm -al
Ap_Id Type Receptacle Occupant Condition
c0 scsi-bus connected configured unknown
c0::dsk/c0t0d0 CD-ROM connected configured unknown
c1 fc-private connected configured unknown
c1::500000e010c3b8e1 disk connected configured unknown
c1::500000e010c466c1 disk connected configured unknown
c1::500000e010c47e51 disk connected configured unknown
c1::500000e010c47f31 disk connected configured unknown
c1::500000e010c49711 disk connected configured unknown
c1::500000e010c49b41 disk connected configured unknown
c1::50800200001f8811 ESI connected configured unknown
c2 fc-fabric connected configured unknown
c2::50060e8000c41da3 disk connected configured unknown
c2::50060e8000c41da7 disk connected configured unknown
c2::50060e8004f35919 disk connected unconfigured unknown
c3 fc-fabric connected configured unknown
c3::50060e8000c41da2 disk connected configured unknown
c3::50060e8000c41da6 disk connected configured unknown
c3::50060e8004f35909 disk connected unconfigured unknown
pcisch0:hpc1_slot0 fibre/hp connected configured ok
pcisch0:hpc1_slot1 unknown empty unconfigured unknown
pcisch0:hpc1_slot2 unknown empty unconfigured unknown
pcisch0:hpc1_slot3 unknown empty unconfigured unknown
pcisch2:hpc2_slot4 unknown empty unconfigured unknown
pcisch2:hpc2_slot5 unknown empty unconfigured unknown
pcisch2:hpc2_slot6 unknown empty unconfigured unknown
pcisch3:hpc0_slot7 fibre/hp connected configured ok
pcisch3:hpc0_slot8 pci-pci/hp connected configured ok
You can see that c3::50060e8004f35909 c2::50060e8004f35919 not configured.
Run cfgadm
cfgadm -o force_update -c configure c2
Now you can see c2::50060e8004f35919 configured. Do this also for c3
# cfgadm -al
Ap_Id Type Receptacle Occupant Condition
c0 scsi-bus connected configured unknown
c0::dsk/c0t0d0 CD-ROM connected configured unknown
c1 fc-private connected configured unknown
c1::500000e010c3b8e1 disk connected configured unknown
c1::500000e010c466c1 disk connected configured unknown
c1::500000e010c47e51 disk connected configured unknown
c1::500000e010c47f31 disk connected configured unknown
c1::500000e010c49711 disk connected configured unknown
c1::500000e010c49b41 disk connected configured unknown
c1::50800200001f8811 ESI connected configured unknown
c2 fc-fabric connected configured unknown
c2::50060e8000c41da3 disk connected configured unknown
c2::50060e8000c41da7 disk connected configured unknown
c2::50060e8004f35919 disk connected configured unknown
c3 fc-fabric connected configured unknown
c3::50060e8000c41da2 disk connected configured unknown
c3::50060e8000c41da6 disk connected configured unknown
c3::50060e8004f35909 disk connected unconfigured unknown
pcisch0:hpc1_slot0 fibre/hp connected configured ok
pcisch0:hpc1_slot1 unknown empty unconfigured unknown
pcisch0:hpc1_slot2 unknown empty unconfigured unknown
pcisch0:hpc1_slot3 unknown empty unconfigured unknown
pcisch2:hpc2_slot4 unknown empty unconfigured unknown
pcisch2:hpc2_slot5 unknown empty unconfigured unknown
pcisch2:hpc2_slot6 unknown empty unconfigured unknown
pcisch3:hpc0_slot7 fibre/hp connected configured ok
pcisch3:hpc0_slot8 pci-pci/hp connected configured ok
After that I can see disk in format menu. Change disk layout.
6. c4t60060E8004F359000000F35900000D1Ad0
/scsi_vhci/ssd@g60060e8004f359000000f35900000d1a
Create file system
newfs /dev/rdsk/c4t60060E8004F359000000F35900000D1Ad0s0
Thursday, 7 August 2008
Making rpm package from source
If you downloaded source rpm package like *.src.rpm,
You cand make rpm package with rpmbuild command.
# rpmbuild --rebuild /var/tcell/packagename.src.rpm
You cand make rpm package with rpmbuild command.
# rpmbuild --rebuild /var/tcell/packagename.src.rpm
Sysstat linux package - sar sa1 sa2 sadc
For SUSE I installed these packages before installing sysstat
rpm -ivh libgcj-3.3.3-43.24.i586.rpm
rpm -ivh plotutils-2.4.1-575.1.i586.rpm
rpm -ivh gettext-0.14.1-30.1.i586.rpm
rpm -ivh sysstat-5.0.1-35.1.i586.rpm
rpm -ivh gnuplot-3.7.3-256.1.i586.rpm
sysstat-8.1.2-4.1.i586.rpm
I took some time for me to find cron job location
/etc/cron.d/sysstat
#crontab for sysstat
#activity reports every 10 minutes everyday
-*/10 * * * * root /usr/lib/sa/sa1
#update reports every 6 hours
0 */6 * * * root /usr/lib/sa/sa2 -A
You can check reports via sar command. If you want to be sure that cron wor
sar -f /var/log/sa/sa07
Last two digit depends on day of month
You can find configuration file under /etc/sysstat
ls /etc/sysstat
sysstat sysstat.cron sysstat.ioconf
rpm -ivh libgcj-3.3.3-43.24.i586.rpm
rpm -ivh plotutils-2.4.1-575.1.i586.rpm
rpm -ivh gettext-0.14.1-30.1.i586.rpm
rpm -ivh sysstat-5.0.1-35.1.i586.rpm
rpm -ivh gnuplot-3.7.3-256.1.i586.rpm
sysstat-8.1.2-4.1.i586.rpm
I took some time for me to find cron job location
/etc/cron.d/sysstat
#crontab for sysstat
#activity reports every 10 minutes everyday
-*/10 * * * * root /usr/lib/sa/sa1
#update reports every 6 hours
0 */6 * * * root /usr/lib/sa/sa2 -A
You can check reports via sar command. If you want to be sure that cron wor
sar -f /var/log/sa/sa07
Last two digit depends on day of month
You can find configuration file under /etc/sysstat
ls /etc/sysstat
sysstat sysstat.cron sysstat.ioconf
Subscribe to:
Posts (Atom)