Ir al contenido
 Español      
HP.com Venezuela principal Productos y Servicios Soporte y Controladores Soluciones Cómo Comprar
» Contactar HP
     Búsqueda avanzada en foros
HP.com Venezuela principal
IT Resource Center Forums > Linux > general

cd ~homedir not working

» 

Centro de Recursos de Tecnología Informática

» Inicio de sesión
» Registro
» Mi perfil
» Búsqueda en la base de conocimientos
» Foros
» Base de datos de parches
» Descargar controladores, software y firmware
» Comprobación de la garantía
» Administrador de casos de soporte
» Administrador de actualizaciones de software
» Capacitación y educación
» Más opciones de mantenimiento y soporte
» Ayuda online
» Mapa del sitio

Member icons
 
 HP moderator  HP moderator
 Expert in this area  Expert in this area
Member status
ITRC Pro ITRC Pro
250 points
ITRC Graduate ITRC Graduate
500 points
ITRC Wizard ITRC Wizard
1000 points
ITRC Royalty ITRC Royalty
2500 points
ITRC Pharaoh ITRC Pharaoh
7500 points
Olympian Olympian
20000 points
1-Star Olympian 1-Star Olympian
40000 points
2-Star Olympian 2-Star Olympian
80000 points
»  How to earn points
»  Support forums FAQs
Question status
Magical answer Magical answer
Message with a response that solved the author's question
Favorites status
Add to my favorites Add to my favorites
Delete from my favorites Delete from my favorites
This thread has been closed Thread closed
 

Aquí empieza el contenido
   Create a new message    Receive e-mail notification if a new reply is posted  Reply to this message
Author Subject: cd ~homedir not working      Add to my favorites
Allanm
Nov 2, 2009 23:41:20 GMT   

For sometime now, I am unable to do -

cd ~homedir
but
cd /homedir works...

Can you suggest some pointers as to how I can troubleshoot or fix this?

Thanks,
Allan.
Note: If you are the author of this question and wish to assign points to any of the answers, please login first.For more information on assigning points ,click here


Sort Answers By: Date or Points
Allanm
Nov 2, 2009 23:47:25 GMT    N/A: Question Author

Also sudo bash takes a very long time to come back to the password prompt...
Steven Schweda This member has accumulated 7500 or more points
Nov 3, 2009 00:00:04 GMT    Unassigned

> cd ~homedir

If you want "/homedir", then say "/homedir".
The "~user_name" notation is used with a user
name.  That path to that user's home
directory is obtained from the "passwd" data
base ("/etc/passwd", or wherever).  Unless
there's a user name of "homedir", "~homedir"
makes no sense.

What is the user name here?

Where is that user's home directory?
Allanm
Nov 3, 2009 00:05:41 GMT    N/A: Question Author

Sorry I meant cd ~user-home-dir, cd /user-home-dir works.

Also sudo bash is very slow to respond...
Steven Schweda This member has accumulated 7500 or more points
Nov 3, 2009 03:50:14 GMT    Unassigned

> Sorry I meant cd ~user-home-dir,
> cd /user-home-dir works.

So, does that mean that you're happy, or is
there still a problem/question there?

> Also sudo bash is very slow to respond...

A different thread with "sudo" in the Subject
might get more attention from people who know
more about sudo than I.
Goran Koruga This member has accumulated 1000 or more points
Nov 3, 2009 06:10:40 GMT    Unassigned

Hi.

Did you check which is the homedir set for your user?

getent passwd <username>

Next to last field is homedir.

Regards,
Goran
Kapil Jha This member has accumulated 1000 or more points
Nov 3, 2009 11:48:24 GMT    Unassigned

its ~user_id
if your user id existe and it has home dir.

have you seen some other problem or some specific thing when you not able to do this.
BR,
Kapil+
Matti Kurkela Expert in this area This member has accumulated 7500 or more points
Nov 3, 2009 12:39:18 GMT    Unassigned

When you execute "cd ~foo", the shell checks the home directory location of user "foo" from the user database (usually /etc/passwd, but can be NIS or LDAP too if configured) and then moves to that directory.

If the user "foo" has his home directory set as /home/bar, the command "cd ~foo" moves to /home/bar.

Since you say your "cd /homedir" works, it is probably not a home directory permission problem.

Maybe the user cannot look up the home directory location for some reason?
What are the permissions of /, /etc and /etc/passwd?

Please run:

ls -ld / /etc /etc/passwd

The response should be something like this. Note the permissions:
drwxr-xr-x 25 root root 4096 2009-10-20 13:30 /
drwxr-xr-x 162 root root 16384 2009-11-03 12:57 /etc
-rw-r--r-- 1 root root 1854 2009-10-06 15:18 /etc/passwd

MK
Dirk Dierickx Expert in this area This member has accumulated 1000 or more points
Nov 5, 2009 08:48:28 GMT    Unassigned

normally 'cd ~' will take you to your own home dir. 'cd ~userhomedir' will not work because that would translate to something like /home/user/user, which probably doesn't exist.

if you want to do 'cd ~otheruserhomedir', i'm not aware this is possible. afaik ~ always points to your own home dir and thus you should address others home dirs always as a full path.
Steven Schweda This member has accumulated 7500 or more points
Nov 5, 2009 15:13:05 GMT    Unassigned

> [...] 'cd ~userhomedir' will not work
> because [...]

For a valid explanation of what this means,
see Matti Kurkela's response.

> [...] i'm not aware [...]

Try it?

debi# cd ~
debi# pwd
/root
debi# cd ~ftp
debi# pwd
/home/ftp

debi# grep '^ftp:' /etc/passwd
ftp:x:110:65534::/home/ftp:/bin/false

Or read about it.  "man <your_shell>" should
provide the details.
Dirk Dierickx Expert in this area This member has accumulated 1000 or more points
Nov 6, 2009 08:20:24 GMT    Unassigned

nice, didn't know about that one yet! is there anything unix can't do? :)
 
Create a new message    Receive e-mail notification if a new reply is posted   Reply to this message
 
 
Printable version
Declaración de confidencialidad El uso de este sitio implica la aceptación de sus políticas de uso
© 2009 Hewlett-Packard Development Company, L.P.