LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 06-09-2012, 12:36 PM   #1
Eerie
LQ Newbie
 
Registered: Mar 2012
Distribution: Slackware 13.37 32-bit/win 7
Posts: 17

Rep: Reputation: Disabled
folder/file highlights vanish when changing user


Hey, I'm using Slackware 13.37 32-bit and there's this little aesthetic problem I've got here.

When I open a new bash it highlights folders and certain extensions when I print them. But as soon as I change user it's all in one colour for the rest of the session.

Any idea how I can make that stick?

(on a completely unrelated note, can someone tell me how to make sudo work? I have a root account but the password for su doesn't work for sudo.)

Thanks in advance.
Attached Thumbnails
Click image for larger version

Name:	blaa.jpeg
Views:	7
Size:	75.7 KB
ID:	9868  
 
Old 06-09-2012, 12:45 PM   #2
DavidMcCann
Senior Member
 
Registered: Jul 2006
Location: London
Distribution: CentOS, Salix
Posts: 4,264

Rep: Reputation: 1246Reputation: 1246Reputation: 1246Reputation: 1246Reputation: 1246Reputation: 1246Reputation: 1246Reputation: 1246Reputation: 1246
Each user will have separate configuration for bash: one's been set for colour, the other isn't.

The password for sudo is your own one, not the root one. You also need to set up the service: see the man page for sudoers. You edit the sudoers file with the command visudo.
 
Old 06-09-2012, 12:50 PM   #3
Eerie
LQ Newbie
 
Registered: Mar 2012
Distribution: Slackware 13.37 32-bit/win 7
Posts: 17

Original Poster
Rep: Reputation: Disabled
That doesn't seem to be what's causing it to disappear though.
Because even when I change back to the user the colours are still gone.
Also, if I logged into root to begin with and then opened a bash the colours are there as well.

And thanks for the sudo help. I'll look into that.
 
Old 06-09-2012, 01:09 PM   #4
colucix
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976
Please, try to see what is the output of the following command for each of the three cases (normal user see colors, switching to root colors disappear, switching to previous user colors still disappeared) and post the output here.
Code:
alias ls
Moreover, take in mind that adding a minus sign as argument of the su command set the environment for the new user. Try what happens with and without it:
Code:
su -
Finally, what happen if you switch back to the previous user, in place of using su again? I mean:
Code:
nado$ ls
nado$ su
root# ls
root# exit
nado# ls
in sequence.

Last edited by colucix; 06-09-2012 at 01:12 PM.
 
1 members found this post helpful.
Old 06-09-2012, 01:40 PM   #5
Eerie
LQ Newbie
 
Registered: Mar 2012
Distribution: Slackware 13.37 32-bit/win 7
Posts: 17

Original Poster
Rep: Reputation: Disabled
usr:
from a fresh shell:
Code:
nado@ass:~$ alias ls
alias ls='/bin/ls $LS_OPTIONS'
nado@ass:~$ su
Password: 
root@ass:/home/nado# alias ls
bash: alias: ls: not found
root@ass:/home/nado# su nado
nado@ass:~$ alias ls
bash: alias: ls: not found
nado@ass:~$
interesting, the su - preserves the highlighting and also prints these quotes (that you can see at the top of screenshot in my first post)
Similarly with exit, regardless of whether I use
Code:
su -
prior or
Code:
su
. Though it doesn't print new funny/smart quotes. But it prints
Code:
logout
and keeps the colours alive.




Quote:
Originally Posted by colucix View Post
Please, try to see what is the output of the following command for each of the three cases (normal user see colors, switching to root colors disappear, switching to previous user colors still disappeared) and post the output here.
Code:
alias ls
Moreover, take in mind that adding a minus sign as argument of the su command set the environment for the new user. Try what happens with and without it:
Code:
su -
Finally, what happen if you switch back to the previous user, in place of using su again? I mean:
Code:
nado$ ls
nado$ su
root# ls
root# exit
nado# ls
in sequence.

Last edited by Eerie; 06-09-2012 at 01:40 PM. Reason: missed a word
 
Old 06-09-2012, 02:25 PM   #6
colucix
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976
Most likely, both the quote and the alias to the ls command come from the user's shell configuration files. As mentioned the minus sign as first argument of su preserve the user's own environment, that is switching this way it executes all the statement inside the configuration files placed in the user's home directory.
The quote comes from the fortune command. You may check where it's placed in your hidden files under your home directory, together with the alias definition, e.g
Code:
nado$ grep -E 'fortune|alias *ls' $HOME/.*
You may also check the value of the environment variable $LS_OPTIONS (where defined) to see if the --color option of ls appears.

The question now is: which configuration files are sourced and in which situation (login shell, interactive non-login shell, switching user w/ or w/o minus sign and so on)? You can try to answer by reading http://www.gnu.org/software/bash/man...#Invoking-Bash and the next chapter http://www.gnu.org/software/bash/man...-Startup-Files (assuming you're using bash as default shell) plus
Code:
man su
Since there are multiple options depending on the presence/absence of some files, you have to investigate your system and the users' set-up directly on your machine. Hope this helps.

Last edited by colucix; 06-09-2012 at 02:27 PM. Reason: corrected 2nd url
 
1 members found this post helpful.
Old 06-10-2012, 11:21 AM   #7
Eerie
LQ Newbie
 
Registered: Mar 2012
Distribution: Slackware 13.37 32-bit/win 7
Posts: 17

Original Poster
Rep: Reputation: Disabled
I've tried some of the things and it's giving me a lot of information. But I really need to sit down and spend some time here.

Thanks to su - and exit my problem is solved, but for the sake of understanding my system I'll leave the thread unsolved.

Thanks for helping out!
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Is it possible to deny super user to access a file/folder in linux. karanace Linux - Security 12 03-03-2012 01:22 AM
Folder permissions to avoid file upload by http user pooja2003 Linux - Security 2 03-06-2011 11:05 AM
How to changes Happened in /etc/shadow file, when user changing password deepak_message Linux - Server 1 01-24-2011 07:10 AM
errors in root and user for .nx file or folder? LVSuSE Linux - Newbie 1 03-07-2007 09:57 AM
i can't create folder or file by root user. Linux For Ever Red Hat 7 01-19-2007 03:34 PM


All times are GMT -5. The time now is 04:55 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration