Skip to content
Advertisement

how make a current directory as home directory in linux

please would you help me with your suggestions on the following :

<> I am using an account on a SLURM cluster where the storage space of my home directory (ie. /home/user) is maximum 32 GB

<> I am running on the SLURM cluster a singularity container that is working only if the the input files are located in the home directory (/home/user that has 32 GB), instead of using any other location on the SLURM cluster (i.e. /labs/professor where we have 7TB)

The question is : is there any way to set up the large account space (i.e. /labs/professor) as a “home directory” in order for the singularity container to run ?

thanks a lot, with much appreciation,

— bogdan

Advertisement

Answer

You can change variable HOME as you like (but i wont recommend that unless you know what things are gonna change) But simpler way is to mane soft links for the directories you like, which i personally do.

ln -s path/of/dir path/to/dir

You can make or edit user-dirs.dirs file under ~/.config directory to this

SECOND_HOME="/labs/professor"
XDG_DESKTOP_DIR="$SECOND_HOME/Desktop"
XDG_DOWNLOAD_DIR="$SECOND_HOME/Downloads"
XDG_DOCUMENTS_DIR="$SECOND_HOME/Documents"
XDG_MUSIC_DIR="$SECOND_HOME/Music"
XDG_PICTURES_DIR="$SECOND_HOME/Pictures"
XDG_VIDEOS_DIR="$SECOND_HOME/Videos"
XDG_TEMPLATES_DIR="$SECOND_HOME/Templates"
XDG_PUBLICSHARE_DIR="$SECOND_HOME/Public"

Here you can change default directories used by system. You can change your SECOND_HOME as you like

Edit: If you want to change your default HOME then overwrite HOME variable on user login (it depends on which display manager you are using, but its easy)

But before that move every thing (ie. .config, .local, etc) directories to the directory which you want to set as HOME (eg. /labs/professor)

Or you can directly run

usermod -m -d /newhome/username username

Here -m (abbreviation for –move-home) will move the content from the user’s current directory to the new directory.

User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement