Skip to content

Instantly share code, notes, and snippets.

@octlabs
Last active September 2, 2024 02:31
Show Gist options
  • Save octlabs/904a346c778beba6c528aca4266d7efe to your computer and use it in GitHub Desktop.
Save octlabs/904a346c778beba6c528aca4266d7efe to your computer and use it in GitHub Desktop.
Netatalk CentOS 8 network share

Setup MacOS AFP mounts with Apple timemachine for small office sharings on Linux CentOS 8

All users can access via AFP the same file share folders like sambe "force user, force group" using linux group s-bit and file and dir mask.

Also with cloud hub to store files local for faster access and not to have to store the data on all end devices.

Example shard directory for /vol1/shares/projects. /vol1/shares/customers

Example nexcloud sync path /vol1/cloud

Linux Users: cloud, employee1, employee2, employee3 ... all with same gid=100(users)

Prepare

yum install netatalk avahi-daemon
chown cloud.users /vol1/shares/cloud
chown employee1.users /vol1/shares/cloud

chmod -R g+rw /vol1/shares/*
find /vol1/shares/* -type d -exec chmod g+s {} \;

Set privilges to cloud user wen sync by client to use valid create mask

vi /etc/profile

if [ $UID -gt 199 ]; then
    umask 002
else
    umask 022
fi

Setup Netatalk AFP fileserver for Macintosh clients

/etc/netatalk/afp.conf

[Global]
hostname	= omega
uam list	= uams_dhx2.so
disconnect time = 3
sleep time = 2
log file = /var/log/netatalk.log
zeroconf = yes
save password = no

[Homes]
basedir regex = /home
home name = $u

[Time Machine Employee1]
path = /vol1/timemachine/employee1
valid users = employee1
time machine = yes
vol size limit = 2000000
unix priv = yes
file perm = 0600

[cloud]
path = /vol1/cloud
valid users = employee1, employee2, employee3
file perm = 0660
directory perm = 4770

[customers]
path = /vol1/shares/customers
valid users = employee1, employee2
file perm = 0660
directory perm = 4770

[projects]
path = /vol1/shares/projects
valid users = employee4, employee5
file perm = 0660
directory perm = 4770

Setup System service

systemctl enable netatalk.service
systemctl start netatalk.service
systemctl status netatalk.service

... Setup firewall

crontab

0 15 * * * /usr/bin/chown -R cloud.users /vol1/cloud
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment