LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 02-07-2017, 05:27 PM   #1
smiffy
LQ Newbie
 
Registered: Feb 2015
Location: Plaistow, West Sussex
Distribution: Fedora & Centos
Posts: 5

Rep: Reputation: Disabled
login doesn't cd to /home/<user>


I've just done a clean install of Fedora 25 - clean all except the /home directories are on a separate disk/partition and are a carry over from the previous installation (F23). I added myself as a user and checked that the /home path contained my directory and my files and had the correct UID/GID (1000:100).

When I log in all goes well until I open a Terminal. At this point the prompt shows the current working directory as / not ~ as I would expect. 'ls -l' shows the path is actually / and the usual suspects are listed (dev, etc, sys, var, usr etc) all owned by root.

If iI then type 'cd' the prompt path does become ~ and my files are listed by 'ls'.

This is strange behaviour. Not something I've ever seen before (I've been using Linux since 1993 - kernel 0.99pl12)

The contents of my .bashrc and .bash_profile all seem to be normal. It would appear that the login process fails to set the correct path. The path in /etc/passwd is correct.

The environment variable $HOME is set correctly as even when the Terminal prompt is showing / as the path.

If I log in via ssh the prompt is ~ It only appears to be wrong in the Terminal window until I perform a 'cd'.

HOWEVER, if i create a new user using Settings -> Users the behaviour is normal. So the anomalous behaviour is something to do with the hold-over from my old F23 installation. The major difference between creating a new user and my old user is all new skeleton files that are added to the new home directory.

Anyone have any idea why this might be happening? It's driving me up the wall.
 
Old 02-07-2017, 07:07 PM   #2
AwesomeMachine
LQ Guru
 
Registered: Jan 2005
Location: USA and Italy
Distribution: Debian testing/sid; OpenSuSE; Fedora; Mint
Posts: 5,513

Rep: Reputation: 1009Reputation: 1009Reputation: 1009Reputation: 1009Reputation: 1009Reputation: 1009Reputation: 1009Reputation: 1009
It's because the system is not adopting the holdover home directory as the new user's home. You might do
Code:
$ chown -R user:user /home/user
 
Old 02-07-2017, 08:42 PM   #3
BW-userx
LQ Guru
 
Registered: Sep 2013
Location: Somewhere in my head.
Distribution: Slackware (current), FreeBSD, Win10, It varies
Posts: 9,952

Rep: Reputation: 2148Reputation: 2148Reputation: 2148Reputation: 2148Reputation: 2148Reputation: 2148Reputation: 2148Reputation: 2148Reputation: 2148Reputation: 2148Reputation: 2148
fstab needs to reflect change or address to partition of /home

Code:
point of origin -> destination
/dev/sdxx  /home   ext4 defaults 0 1
along with what @AwesomeMachine said.

whenever I do this, because I keep my / (root) and /home separate

during install point it to /dev/sdxx /home no format
then create my user by the same name that is already there, it just says home/user name already there, no big deal, then give my user a password, log out of root then into my user no problem.
 
Old 02-08-2017, 03:16 AM   #4
smiffy
LQ Newbie
 
Registered: Feb 2015
Location: Plaistow, West Sussex
Distribution: Fedora & Centos
Posts: 5

Original Poster
Rep: Reputation: Disabled
@BW-userx

Yep, fstab has just such an entry (except I use LABEL=/home to identify the disk/partition) and I do just the same as you during and after the install. I got the message about the home/user name already there. But unlike you when I logged out of root and into my account there is this problem!

@AwesomeMachine

The /home/user directory and all the files therein have the correct UID/GID already.

This problem only occurs when I use the GUI (presumably Gnome 3) NOT when I log in via ssh. What's the difference?
 
Old 02-08-2017, 07:14 AM   #5
smiffy
LQ Newbie
 
Registered: Feb 2015
Location: Plaistow, West Sussex
Distribution: Fedora & Centos
Posts: 5

Original Poster
Rep: Reputation: Disabled
Well here's a strange occurrence. For unconnected reasons I set SELINUX=disabled in /etc/selinux/config and my problem has gone away!

If anyone can explain that I'd be very interested.

Thanks for all the suggestions AwesomeMachine & BW-userx.

Cheers

Chris
 
Old 02-08-2017, 07:30 AM   #6
BW-userx
LQ Guru
 
Registered: Sep 2013
Location: Somewhere in my head.
Distribution: Slackware (current), FreeBSD, Win10, It varies
Posts: 9,952

Rep: Reputation: 2148Reputation: 2148Reputation: 2148Reputation: 2148Reputation: 2148Reputation: 2148Reputation: 2148Reputation: 2148Reputation: 2148Reputation: 2148Reputation: 2148
Quote:
Originally Posted by smiffy View Post
Well here's a strange occurrence. For unconnected reasons I set SELINUX=disabled in /etc/selinux/config and my problem has gone away!

If anyone can explain that I'd be very interested.

Thanks for all the suggestions AwesomeMachine & BW-userx.

Cheers

Chris
It looks like maybe you been put on the DOD list .. you know that LIST

Quote:
Security-Enhanced Linux (SELinux) is a Linux kernel security module that provides a mechanism for supporting access control security policies, including United States Department of Defense–style mandatory access controls (MAC).

SELinux is a set of kernel modifications and user-space tools that have been added to various Linux distributions. Its architecture strives to separate enforcement of security decisions from the security policy itself and streamlines the volume of software charged with security policy enforcement. The key concepts underlying SELinux can be traced to several earlier projects by the United States National Security Agency (NSA).
more here
Security-Enhanced Linux

I'm glad you didn't have to jump through too many hoops and head aches before you got it fixed.

Last edited by BW-userx; 02-08-2017 at 07:32 AM.
 
Old 02-08-2017, 10:26 AM   #7
DavidMcCann
LQ Veteran
 
Registered: Jul 2006
Location: London
Distribution: PCLinuxOS, Debian
Posts: 5,774

Rep: Reputation: 2133Reputation: 2133Reputation: 2133Reputation: 2133Reputation: 2133Reputation: 2133Reputation: 2133Reputation: 2133Reputation: 2133Reputation: 2133Reputation: 2133
Probably SELinux has the other disk wrongly labeled. Try relabeling (see man selinux).
A check shows the context on my system is
/home home_root_t
/home/david user home directory
/home/david/* user data

Last edited by DavidMcCann; 02-08-2017 at 10:32 AM.
 
  


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
login as other user using shell doesn't load the profile for that user ukiome Linux - General 11 12-19-2009 05:56 AM
/home/user not found at login KenHirst Linux - Newbie 2 08-28-2007 10:25 PM
user home dir doesn't create when new user add dev_mohamed Linux - Software 3 01-12-2007 01:08 AM
How to get home directory of a login user lucky6969b Programming 5 02-20-2006 01:46 AM
login error: home directory supposedly doesn't exist jmelton Linux - General 3 11-30-2003 12:42 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 06:33 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
Open Source Consulting | Domain Registration