DirectAdmin将用户目录修改为数据盘

一、修改新增用户主目录

Edit /etc/defaut/useradd and set HOME=/home to HOME=/home2.

DA itself doesn't care where the new home is.

The useradd program is the one who decides where it goes, so by changing the default path for useradd, DA will follow without complaint

vi /etc/defaut/useradd

# useradd defaults file
GROUP=100
HOME=/mnt/disk500
INACTIVE=-1
EXPIRE=
SHELL=/bin/bash
SKEL=/etc/skel
CREATE_MAIL_SPOOL=yes

二、修改已有用户主目录

There are plausibly cases where you'd want to move an existing User from one partition to another partition, so let's assume:

Username: hxs
Old home: /home
New home: /mnt/disk1000

Steps to move hxs from /home to /mnt/disk1000 would be:

Copy the data to the new drive:

cd "/mnt/disk1000"

cp -Rp "/home/hxs" "./hxs"

Once you have 2 copies of the data (one in each partition), and the permissions match, change the system to point to the new path with:

usermod -d "/mnt/disk1000/hxs" "hxs"
Note, we don't use the -m option (which would have moved the data, allowing us to skip step #1, to allow us time to change other configs without breaking the live website).

Update the configs to point to the new path by issuing a rewrite:

cd /usr/local/directadmin/custombuild
./build rewrite_confs
echo "action=rewrite&value=email_passwd&user=hxs" >> /usr/local/directadmin/data/task.queue

也可以直接切换到root用户,修改/etc/passwd文件
hxs:x:1002:1003::/mnt/disk1000/hxs:/usr/bin/jailshell

发表回复

您的电子邮箱地址不会被公开。 必填项已用 * 标注