Solaris 10 - 'ls' green for root user only


 
Thread Tools Search this Thread
Operating Systems Solaris Solaris 10 - 'ls' green for root user only
# 8  
Old 12-27-2014
Since you already said that /usr/bin/ls on Solaris systems doesn't not support the --color option, there has to be an alias (or another ls in PATH before /usr/bin) that is setting the text color to green (and leaving it that way). /usr/bin/ls isn't doing this.

What shell scripts did you prepare with colored output? I would suspect that one of them is your culprit.
# 9  
Old 12-27-2014
Some simple script, nothing special. One of them was ping test with colored output depends on the answer. I tested some color commands in terminal and could be that one of them is messing this up now. Ping script we run without root privileges so cannot be script itself, cos 'ls' for simple users and admin is fine. Only root affected.
I will double check type command and make sure if this is really /usr/bin/ls.
Is 'echo $PATH' ok for checking this?
# 10  
Old 12-27-2014
You don't need to run with root privileges to change the text color of your output. Once you set the text color, it will remain in effect until something else changes the text color (or resets the terminal to "default" settings).

You said in your first post in this thread that 'tput sgr0 fixes the problem. Some script is effectively performing a tput that is setting text color to green and not using 'tput sgr0 to turn it off before it exits.
# 11  
Old 12-27-2014
That could be the point but I am not convinced due to tput sgr0 does not fix it permanently. If I turn it off using above command and use 'ls' after that, then all is green again.
I will check all scripts once again.
# 12  
Old 12-27-2014
If:
Code:
tput sgr0;echo black text;ls

gives you "black text" in black and ls output in green; you have to have an ls function, an ls alias, or a directory containing an ls in PATH before /usr/bin unless you have a corrupted version of ls installed in /usr/bin.

When you get back to the office, type ls should tell you what is going on. If it doesn't; show us the output from:
Code:
ls -l /usr/bin/l*;sum /usr/bin/ls;uname -a

so someone with the same Solaris release can verify that the timestamp and sum match the "normal" values.
This User Gave Thanks to Don Cragun For This Post:
# 13  
Old 12-27-2014
This will give you the size of the "ls" binary that was installed on your server via Sun package:
Code:
grep usr/bin/ls /var/sadm/pkg/SUNWcsu/save/pspool/SUNWcsu/pkgmap | awk '{ print $8 }'

Note that the string you are grepping for does NOT start with a forward slash. This also won't work if your system has a patched "ls" binary.

FWIW, field 9 is the file checksum, obtained with "sum". Field 10 is the original modification time in seconds. You can get the current mod time of the binary in that format with
Code:
stat -c %Y /usr/bin/ls

if your system has the "stat" utility.

If you don't have the "stat" utility, you can get the mod time in seconds with
Code:
truss -t\!all -tstat -vstat ls /usr/bin/stat

You'll see the mod time in the data emitted for the "stat()" call on "/usr/bin/ls".

Last edited by achenle; 12-27-2014 at 09:19 PM..
This User Gave Thanks to achenle For This Post:
# 14  
Old 12-28-2014
Quote:
Originally Posted by TiedCone
I will double check type command and make sure if this is really /usr/bin/ls.
Is 'echo $PATH' ok for checking this?
"echo $PATH" won't help that much identifying what command is run especially as you previously stated you believe "which ls" reported "/usr/bin/ls".
I more than strongly doubt your /usr/bin/ls binary is corrupted in a way that it still works as usual but set the color to green. That would be an extraordinary dubious event.

As already written, "type ls" is the only reliable and portable way to know what is "ls" under the cover.

If it shows "ls" is an alias or a function, check where it is defined in the shell initialization files like /etc/profile, .profile, .bash_profile, .kshrc, .bashrc, .bash_login, $ENV, $FPATH, ... depending on the actual shell used.
Login or Register to Ask a Question

Previous Thread | Next Thread

8 More Discussions You Might Find Interesting

1. Solaris

Root user not recognizing on Solaris-10 (shadow file corruption)

Hello, I got into a wired state on one of solaris 10 server. When I noticed that server is having some issue, I found that there were dumpadm.conf entries in /etc/shadow and real entries were wiped of. Probably somebody fat fingers. I was able to boot into failsafe, break SVM mirror, copied... (25 Replies)
Discussion started by: solaris_1977
25 Replies

2. SuSE

Non root user want to see /var/log/messages - any suse equivalent of Solaris dmesg

Hi New to Suse - mainly used Solaris. In solaris dmesg will also show you contents of messages log file but in Suse Liux it doesnt appear to. I dont have root access to this Suse server, and wondering is there any other tool / utility that allows me to see the messages file contents like on... (1 Reply)
Discussion started by: frustrated1
1 Replies

3. UNIX for Dummies Questions & Answers

Sudo to delegate permission from non-root user to another non-root user

I've been through many threads before i decide to create a separate thread. I can't really find the solution to my (simple) problem. Here's what I'm trying to achieve: As "canar" user I want to run a command, let's say "/opt/ocaml/bin/ocaml" as "duck" user. The only to achieve this is to... (1 Reply)
Discussion started by: canar
1 Replies

4. Solaris

Enable FTP for root user in Solaris 10

I am not able to get ftp working for Solaris 10 for root user. I am getting login failed error. 331 Password required for root. Password: 530 Login incorrect. Login failed. Tried following things already. 1. SFTP works ok, still would like to know why FTP is not working (curious). 2.... (5 Replies)
Discussion started by: webkid
5 Replies

5. UNIX for Dummies Questions & Answers

How to allow access to some commands having root privleges to be run bu non root user

hi i am new to unix and i have abig task. i have to \run particular commands having root privileges from a non root user. i know sudo is one of the way but i need sum other approach kindly help Thanks (5 Replies)
Discussion started by: suryashikha
5 Replies

6. Solaris

Non-root user access to privileged ports-Solaris 8

Please let me know how to setup a non-root user to be able to access a privileged port (<1024) on Solaris 8. I am currently running tomcat as "tomcat" user and I get the following error during to start up: SEVERE: Error initializing endpoint java.net.BindException: Permission denied<null>:443 (5 Replies)
Discussion started by: pingmeback
5 Replies

7. Solaris

How to start CDE for non root user on Solaris 10

Hi, How can I start CDE for non root user created.For root CDE is working fine but for non root user CDE exits back to login screen after trying for some time.Also I cant see .dt and .dtprofile files in the users home directory.How can I create them.Kindly help. Thanks & Regards, Kiran. (1 Reply)
Discussion started by: kiranherekar
1 Replies

8. Solaris

Permissions for the root user on Solaris 10

Hi I have a doubt, here if a file does not have the write permissions to the root user my script is going to write the data into that file. when i executed the script as root user. Is it correct ... ? (4 Replies)
Discussion started by: Shreedhar Naik
4 Replies
Login or Register to Ask a Question