Chnage direcortory upon login


 
Thread Tools Search this Thread
Operating Systems Linux Red Hat Chnage direcortory upon login
# 1  
Old 04-08-2008
Chnage direcortory upon login

Hi,

I am using Redhat 4AS and I'm planning to change the default directory (/home/psuser) upon login to /opt/directory/.

This is my .bash_profile entry:
Code:
# .bash_profile

# Get the aliases and functions
if [ -f ~/.bashrc ]; then
        . ~/.bashrc
fi

# User specific environment and startup programs
PATH=$PATH:$HOME/bin
export PATH
unset USERNAME
. ~/test

This is the entry of my test file:
Code:
cd /opt/some directory/

However when i logged in using psuser account, im still directed to /home/psuser. Can anyone know what am i doing wrong?

Thanks!
# 2  
Old 04-09-2008
Why do you have " . ~/test " I have in my test .bashrc file :
Code:
[test@host]$ cat ~/.bashrc
# .bashrc

# Source global definitions
if [ -f /etc/bashrc ]; then
        . /etc/bashrc
fi

cd /opt/

and it works OK.
# 3  
Old 04-09-2008
Do you mean that i should put the cd /opt/some directory/ to the .bashrc instead of the .bash_profile?

I thought that the .bash_profile is the same as the .profile of some unix machine..
# 4  
Old 04-09-2008
It's not exactly the same. bash executes .bash_profile when you first log in, but if you are in an X session and open a new terminal window, that doesn't necessarily count as a login. Can you add some simple debug statement to your .bash_profile to see when it is actually executed?

Code:
echo '## .bash_profile' >&2

# 5  
Old 04-09-2008
The .bash_profile is not being executed.
I'm actually doing a telnet session from a remote machine.

I also tried to add the "cd /opt/some directory" to my .bashrc but still its not wroking. I don't know what's wrong with our linux machine. Smilie
# 6  
Old 04-10-2008
Can you tell whether your .bashrc is being invoked when you log in then? Add some debug print there too.
# 7  
Old 04-10-2008
The obvious question is what shell are you assigned in your password entry...
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

First login on KUbuntu 16.04 no SKEL copied with first login LDAPusers

Hello, we have an problem on kubuntu16.04 that when i login with ldap, and it is my first login, nothing is copied from skel. With SSH it is working fine. Can anyone say we how KDE setup an new first userlogin? Tested with SDDM and Lightdm. Thanks a lot! Best Regard darktux ----------... (1 Reply)
Discussion started by: darktux
1 Replies

2. UNIX for Dummies Questions & Answers

How to chnage format and subtract time and date and get average.?

Hello All , Please support for below request how to change format and subtract time and date and get average. xxx 13-OCT-15 11.32.18.241000 AM 13-OCT-15 11.35.49.089080 AM xxx 13-OCT-15 11.32.24.000000 AM 13-OCT-15 11.45.17.810904 AM xxx 13-OCT-15 11.32.25.232000 AM ... (1 Reply)
Discussion started by: mirwasim
1 Replies

3. UNIX for Advanced & Expert Users

Can adding to a new group be effective in current login environment without re-login?

Hey folks, When a user is added to a new group, the user has to be log out and log in again to make the new group effective. Is there any system command or technique to refresh user group ID update without re-login? I am not talking about to use "login" or "su -l" commands which can only make... (2 Replies)
Discussion started by: hce
2 Replies

4. AIX

User Account Login Login on your AIX server

I want to learn AIX. I would like to find someone who would be willing to give me a login to their AIX home lab server. My intent is to poke around and discover the similarities and differences of AIX compared to other *NIXs. I am a UNIX admin so I can think of what some immediate concerns may... (1 Reply)
Discussion started by: perl_in_my_shel
1 Replies

5. Solaris

error message rmclomv ... SC Login Failure for user Please login:

Hello World ~ HW : SUN Fire V240 OS : Solaris 8 Error message prompts 'rmclomv ... SC login failure ...' on terminal. and Error Message prompts continually 'SC Login Failure for user Please login:' on Single Mode(init S) The System is in normal operation, though In case of rain, Can... (1 Reply)
Discussion started by: lifegeek
1 Replies

6. Cybersecurity

APACHE: Tie in Web Page login with server login

Hello, I have created a web page on a server using apache and added .htaccess and .htpasswd in the folder for authentification. I was wondering if there was anyway to tie-in the login for this page with the login used to logon to the server. i.e. the same login info. is used for both, when... (1 Reply)
Discussion started by: WhotheWhat
1 Replies

7. Web Development

APACHE: Tie in Web Page login with server login

Hello, I have created a web page on a server using apache and added .htaccess and .htpasswd in the folder for authentification. I was wondering if there was anyway to tie-in the login for this page with the login used to logon to the server. i.e. the same login info. is used for both,... (2 Replies)
Discussion started by: WhotheWhat
2 Replies

8. Shell Programming and Scripting

xml value chnage, need help

Group, I have a xml file like this. <roll no="32" Name="test" home="AZ" Type="par"> <Info cid="5"> I have to change the "roll no" to a different value say, 66 i.e. required output: <roll no="66" Name="test" home="AZ" Type="par"> <Info cid="5"> Please help. Anything with sed or awk... (2 Replies)
Discussion started by: jkl_jkl
2 Replies

9. Solaris

Solaris 10 - dtlogin port chnage?

I have changed my dtlogin port from the deault 177 to 180. When I'm at the Remote Login session screen, how do I specify the port number? (5 Replies)
Discussion started by: kungpow
5 Replies
Login or Register to Ask a Question