I came across a problem running required security scripts. The script runs the following command to build a list of directories to scan.
ls -lL / | grep “^d” | egrep -v “tcb$|dev$|proc$|vol$|xfn$|cdrom$|mnt$” |awk ‘{print “/”$9}’
I have the following Distros:
Cent 4 and 5
openSUSE 11.1 11.3 11.4 12.1
Only 11.3 is showing a problem with ls. 11.3 is using the iso time format for ls -l, this changes the number of fileds. So the directory name is now field 8 instead of nine. Insead of getting a list of directories I get a bunch of /'s.
Atlas:~ # ls -lL / | grep "^d" | egrep -v "tcb$|dev$|proc$|vol$|xfn$|cdrom$|mnt$" |awk '{print "/"$9}'
/atlas
/bin
/boot
/.config
/etc
/home
/lib
/lib64
/localData
/media
/opt
/root
/sbin
/selinux
/srv
/sys
/tmp
/usr
/var
/xenaRaid
Hagar:~ # ls -lL / | grep "^d" | egrep -v "tcb$|dev$|proc$|vol$|xfn$|cdrom$|mnt$" |awk '{print "/"$9}'
/
/
/
/
/
/
/
/
/
/
/
/
/
/
/
/
/
/
This causes the script to build a list of files on the system that is 18 times then it should be.
Using ls -lLd /root to test. I have a script that I can send a remote command to all of my linux computers, the only ones that use the iso time format are the 11.3 computers.
Atlas openSUSE 11.4
Atlas:~ # ls -lLd /root
drwx------ 41 root root 4096 Jan 6 10:31 /root
Atlas:~ # alias
.
..
...
alias l='ls -alF'
alias la='ls -la'
alias ll='ls -l'
alias ls='ls $LS_OPTIONS'
alias ls-l='ls -l'
...
..
.
Atlas:~ # echo $LS_OPTIONS
-A -N --color=tty -T 0
Hagar openSUSE 11.3
Hagar:~ # ls -lLd /root
drwx------ 44 root root 4096 2012-01-06 10:31 /root
Hagar:~ # alias
.
..
...
alias l='ls -alF'
alias la='ls -la'
alias ll='ls -l'
alias ls='ls $LS_OPTIONS'
alias ls-l='ls -l'
...
..
.
Hagar:~ # echo $LS_OPTIONS
-A -N --color=tty -T 0
As my self I get the same results as Hagar openSUSE 11.3. But when I use konsole with Root profile I get the same result as all other distros.
Hagar openSUSE 11.3 (konsole --profile Root_Shell)
Hagar:~ # ls -lLd /root
drwx------ 44 root root 4096 Jan 6 10:31 /root
Hagar:~ # alias
.
..
...
alias l='ls -alF'
alias la='ls -la'
alias ll='ls -l'
alias ls='ls $LS_OPTIONS'
alias ls-l='ls -l'
...
..
.
Hagar:~ # echo $LS_OPTIONS
-A -N --color=tty -T 0
I do not see where ls is being told to use the iso time format. Or in the Root_Shell case being told to use the regular format. Does any one know why ls in 11.3 uses the iso time format? Dose anyone else on 11.3 see the same thing?
Thanks
Dave W