Changes

stoney backup: Server set-up

1,578 bytes removed, 12:55, 30 August 2013
/* OpenSSH */
# The '''quotacheck''' command has no effect on XFS filesystems. The first time quota accounting is turned on (at mount time), XFS does an automatic quotacheck internally; afterwards, the quota system will always be completely consistent until quotas are manually turned off.
# There is '''no need for quota file(s)''' in the root of the XFS filesystem.
 
== OpenSSH ==
Configure the OpenSSH daemon:
<source lang="bash">
vi /etc/ssh/sshd_config
</source>
 
Set following options:
<source lang="bash">
PubkeyAuthentication yes
PasswordAuthentication yes
UsePAM yes
Subsystem sftp internal-sftp
</source>
 
Make sure, that <code>Subsystem sftp internal-sftp</code> is the last line in the configuration file.
 
We want to reduce the numbers of chroot environments in one folder. As the <code>ChrootDirectory</code> configuration option only allows <code>%h</code> (home directory of the user) and <code>%u</code> (username of the user), we need to create the necessary matching rules in the form of:
<source lang="bash">
Match User *000
ChrootDirectory /var/backup/000/%u
AuthorizedKeysFile /var/backup/000/%u/%h/.ssh/authorized_keys
Match
Match User *001
ChrootDirectory /var/backup/001/%u
AuthorizedKeysFile /var/backup/001/%u/%h/.ssh/authorized_keys
Match
...
Match User *999
ChrootDirectory /var/backup/999/%u
AuthorizedKeysFile /var/backup/999/%u/%h/.ssh/authorized_keys
Match
</source>
 
The creation of the matching rules is done by executing the following bash commands:
<source lang="bash">
FILE=/etc/ssh/sshd_config;
 
for x in {0..999} ; do \
printf "Match User *%03d\n" $x >> ${FILE}; \
printf " ChrootDirectory /var/backup/%03d/%%u\n" $x >> ${FILE}; \
printf " AuthorizedKeysFile /var/backup/%03d/%%u/%%h/.ssh/authorized_keys\n" $x >> ${FILE}; \
printf "Match\n" >> ${FILE}; \
done
</source>
 
Don't forget to restart the OpenSSH daemon:
<source lang="bash">
/etc/init.d/sshd restart
</source>
== OpenLDAP ==
SLB, editor, reviewer
3,392
edits