all my space is being eaten up on /. hmm. not here...
[root@fullsystem ~]# df -i
Filesystem Inodes IUsed IFree IUse% Mounted on
/dev/mapper/rhel-root 141920 137849 4071 98% /
[root@fullsystem ~]# du -x / | awk '{ if ($1 > 500000) { print $0} }'
755656 /usr/lib64
1567956 /usr/share
3222024 /usr
3431904 /
this is cool, too:
[root@fullsystem ~]# du -xh / | egrep "[0-9]+G.?*|[5-9][0-9][0-9]M.*?" | sort -n >> /tmp/space.sorted
[root@fullsystem ~]# mail -s "space used" me@here < /tmp/space.sorted
[root@fullsystem ~]# du -xh / | egrep "[0-9]+G.?*|[5-9][0-9][0-9]M.*?"
738M /usr/lib64
1.5G /usr/share
3.1G /usr
3.3G /
it is probably under an nfs mount...
Monday, February 8, 2016
my system is full
Wednesday, February 3, 2016
sshd reload & shutdown
let's reload sshd
debian & ubuntu
# /etc/init.d/sshd restart
redhat & centos
# /sbin/service sshd restart
solaris 8 & 9
# /etc/init.d/sshd stop
# /etc/init.d/sshd start
solaris 10 & 11
# svcadm disable ssh
# svcadm enable ssh
suse & sles
# /etc/rc.d/sshd restart
let's shutdown
hpux
reboot : shutdown -ry 0
shutdown: shutdown -hy 0
linux
reboot : shutdown -r now
shutdown: shutdown -h now
solaris 8, 9, 10
reboot : shutdown -y -i6 -g0
shutdown: shutdown -y -i5 -g0
shutdown a datacenter snippet
sadly eof functions are working well, so a do for loop isn't my friend.
#!/bin/bash
# sun
ssh -l root sun8system "sh -c \"shutdown -y -i5 -g0 \"";
# hp
ssh -l root hpuxoldsystem "sh -c \"shutdown -hy 0 \"";
# linux
ssh -l root linuxsystem "bash -c \"shutdown -h now \"";
Monday, February 1, 2016
dear john
ldapsearch -x -D "cn=bindAcct,dc=domain" -w bindpass -h 6.6.6.6 -b ou=users,dc=domain -LLL "(objectClass=shadowAccount)" userPassword > dearjohn \ <- query
sed -i '/^$/d' dearjohn \ <- remove blank lines
sed -i 's/,ou=users,dc=domain//g' dearjohn \ <- strip the domain from the user dn
sed -i 's/dn:\ uid=//g' dearjohn \ <- remove the user dn
sed -i ':a;N;$!ba;s/\n/blast/g' dearjohn \ <- have fun with line breaks
sed -i 's/userPassword//g' dearjohn \ <- strip out attribute
sed -i 's/blast::\ /:/g' dearjohn \ <- format fun
sed -i 's/blast/\n/g' dearjohn \ <- bring the line breaks back
john dearjohn
Warning: only loading hashes of type "des", but also saw type "md5"
Use the "--format=md5" option to force loading hashes of that type instead
Loaded 26 password hashes with 26 different salts (Traditional DES [128/128 BS SSE2-16])
Remaining 25 password hashes with 25 different salts
...
...
...
and now you know how to connect to an ldap server and snarf all the user passwords, get them formatted for
john the ripper using sed and then going about to crack them. the fun.
Wednesday, January 27, 2016
gdbm fatal: lseek error
gdbm fatal: lseek error
on my nice ubuntu 10 system, i get the above when i run an non-existent commmand.
when i issue:
# lasal
i would expect to see something like:
No command 'lastal' found, did you mean:
Command 'lastal' from package 'last-align' (universe)
lasal: command not found
-bash: lasal: command not found
that function is dependent upon this package:
command-not-found
i issue:
# apt-get remove command-not-found
then when i run a non-existent command:
# /usr/bin/python: can't find '__main__.py' in '/usr/share/command-not-found'
oh... there appears to be a bug with command-not-do and amd64
# dpkg -L command-not-found-data
...
# cd /usr/share/command-not-found/programs.d/
# rm amd*
and there we go.
Tuesday, January 26, 2016
solaris 10 nfs client broken?
[root@crapsun ~]# rpcinfo -u localhost nfs
instead of this:
program 100003 version 2 ready and waiting
program 100003 version 3 ready and waiting
program 100003 version 4 ready and waiting
i get errors.
rpc is having a really bad day. no rpcinfo on the localhost means no mounting of nfs exports from other servers.
rpc happens to be a good friend of nfs/client:default
so.
[root@crapsun ~]# svcs -xv
svc:/network/nfs/client:default
i n t e r e s t i n g
[root@crapsun ~]# svcs -xv
svc:/network/rpc/gss:default (Generic Security Service)
State: offline since Tue Jan 26 13:58:42 2016
Reason: Unknown.
See: http://sun.com/msg/SMF-8000-AR
See: man -M /usr/share/man -s 1M gssd
Impact: 6 dependent services are not running:
svc:/network/nfs/client:default
svc:/milestone/multi-user:default
svc:/system/webconsole:console
svc:/application/graphical-login/cde-login:default
svc:/milestone/multi-user-server:default
svc:/application/cde-printinfo:default
[root@crapsun ~]# svcadm enable svc:/network/rpc/gss:default
[root@crapsun ~]# svcadm restart svc:/network/rpc/gss:default
[root@crapsun ~]# svcs -xv
crickets
awesome.
[root@crapsun ~]# mount -a
it works!
Monday, January 25, 2016
one-shot live linux system backup
one shot live linux system backup:
1. install target system with same os as source.
2. boot into target system via a rescue disk.
3. rsync -aAXv root@source:/* /target-rootdirectory --exclude={"/dev/*","/proc/*","/sys/*","/tmp/*","/run/*","/mnt/*","/media/*","/lost+found"}
or if you want to be simple:
rsync -aHxv root@1.2.3.4:/* /target-rootdirectory --exclude=/dev --exclude=/proc --exclude=/sys --exclude=/tmp --exclude=/swap
these are nice:
http://djlab.com/2013/02/cloning-a-live-linux-system-with-rsync-over-ssh/
https://wiki.archlinux.org/index.php/full_system_backup_with_rsync
don't forget to:
updatedb
mandb -c
Subscribe to:
Posts (Atom)