change login dir


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers change login dir
# 1  
Old 01-24-2002
Question change login dir

Ok when I log in to my terminal I land in a dir. How can I change the dir that I start from when I login?

Thanks for the help, sure it is a no brainer for you guys

cd
# 2  
Old 01-24-2002
You can change the dir in the /etc/passwd file, or use the usermod command.
usermod -d newdir loginname
or
usermod -d newdir -m loginname to move the content of the old dir to the new one.

Last edited by sTorm; 01-24-2002 at 08:32 AM..
# 3  
Old 01-24-2002
If this is for the root user, here is something I discovered the other day.

root:/root> cd
root:/root> echo $HOME
/root
root:/root> HOME=/
root:/root> cd
root:/> echo $HOME
/
root:/> HOME=/root
root:/> cd
root:/root>
root:/root> HOME=/usr/local/bin
root:/root> cd
root:/usr/local/bin> HOME=/root
root:/usr/local/bin> cd
root:/root>


There is a variable called $HOME. You can modify it to be what ever you want. When you type "cd" <enter> that is where you will go. As in the example above.

You can make this permanent by putting in the bottom of your .profile. export HOME=/some/dir.

This works for any user, even root and application user IDs.


Smilie Smilie
# 4  
Old 01-28-2002
I tried the " usermod " command and it seems that my unix (Mac OSX) does not have this command. Any other options???



thanks
cd
# 5  
Old 01-28-2002
UNIX or Apple???...

Are you sure that you are running UNIX or are you running Apple's OSX that is based (coded in) UNIX? OSX was created with UNIX because it is more stable. Unless I am mistaken, you are actually running Apple OS that is built on top of UNIX.

This is like saying that you are running DOS when you are actually running Win98.

Correct me if I am wrong.
# 6  
Old 01-29-2002
Darwin (the underlying OS in OSX) is based on BSD4.4, so generally speaking, it is Unix.

lorcet222, log in to a command prompt (as root), and execute the following command:

pico /etc/passwd

If you don't have pico, you'll have to use another (harder to use) editor. Anyways, though, look for a line that begins with your username. You'll see something like this:

samba:x:1005:100Smiliewner of samba files:/home/samba:/bin/false

Now look in the sixth colon-delimited field (in this case it says /home/samba, yours will be different). That is your home directory - where you will be when you first log in. Now if you change that to another directory, THATS where you'll start. Just be sure that you have the rights to be in that directory.

Let us know how it goes.
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. HP-UX

[Solved] Unable to change/create home dir for particular user

Hi all I wanted to change the home dir for a user, but when using smh : SMH->Accounts for Users and Groups->Local Users->Modify User ---------------------------------------------------------------------------------------------------------------------------------------------- * Required... (8 Replies)
Discussion started by: fretagi
8 Replies

2. Solaris

Change Dir doubt and some advice.

Hello, This is my first post in this forum. I need to change the owner of several directories and files in Solaris 10 Operating system, more than 500. The server is in production and my question is: If i change the owner of directories and files, the server can become unstable, i mean,... (2 Replies)
Discussion started by: checoturco
2 Replies

3. Shell Programming and Scripting

Generate a change list of files/dir

Is there a tool that can diff a directory and generate a change list of files in that directory based on a previous snapshot on the directory? For example /etc/a.txt:changed /etc/b.txt:removed /etc/c.txt:added Thanks! (1 Reply)
Discussion started by: overmindxp
1 Replies

4. HP-UX

could not able change permission of /home dir

Hi i am new to this admin area . i have created user with name as "ab" and gave home dir as /home/ab . when i tried to create the /home/ab dir , i got he following error. "mkdir: Failed to make directory "/home/ab"; Operation not applicable " Thanks in advance . (1 Reply)
Discussion started by: expert
1 Replies

5. Solaris

Requesting help to automatically create home dir on login

I know we would not normally do this. However, I would like to have user's home directory created when they log in the first time. I have searched the forums and have not found any help yet. Scenario - environment uses NIS for auth and usually NFS mount HOME. However, I have a pilot environment... (4 Replies)
Discussion started by: 22blaze
4 Replies

6. Solaris

How to change permission for opt dir in Solaris Zones?

Hi All While configuring zone I run add inherit-pkg-dir I thing this command will inherit opt,etc,lib... directories from global zone to non global zone with read permission................ So this makes problem for me I want to edit one file opt dir which is useful for my project but when I... (4 Replies)
Discussion started by: vijaysachin
4 Replies

7. Solaris

Change inherit-pkg-dir to writable

/lib in my sparse zone is running and its inherit-pkg-dir due ti which its readonly is it possible to make it writable if yes how ? (2 Replies)
Discussion started by: fugitive
2 Replies

8. Solaris

cant able to change permission in a DIR as root user

Hi my directory not accepting any commands. its simply telling permission denied. i tried ( cp, mv, rm ) as roor i want to set default permissons to this DIR please find the Logs below. dr-xr-xr-x 1 root root 1 Jun 1 09:04 AP1_ROP ( original dir) root> chmod 777... (5 Replies)
Discussion started by: vijayq8
5 Replies

9. UNIX for Dummies Questions & Answers

I want to change login failure message, "login incorrect"

I want to change login failure message, "login incorrect" deny user login for user id tom sudo passwd -l tom type username and type password on login prompt and then it will display login failure message "login incorrect" console ############ login: tom password: login incorrect... (2 Replies)
Discussion started by: lifegeek
2 Replies

10. Shell Programming and Scripting

how I change dir in dos

Hi I have a dos batch file in window server where I call a cmd command for creating some db. this cmd commad is located in e:\data\abcd\xyz.cmd. Now I call this batch file from unix ssh.sh but my access point is D in window server here I want to change the dos prompt to e:\data\abcd. in... (3 Replies)
Discussion started by: Jamil Qadir
3 Replies
Login or Register to Ask a Question