categories :sharing files
Creating a shared directory
Related workflows
Refs
Devuan forum / Documentation / @ (2026-06-24 10:33:52)
Creating a shared directory / From the tty shell
Common mistakes
If you login as root from another user using su remember to do $ su --login in order to have /usr/sbin in you path otherwise some command will be accessible only giving their full path. (ref:@), (fhs@)
Conventions used.
A command executed from root is prefixed with the (#) prompt symbol.
A command executed from a user is prefixed with the ($) prompt symbol.
Overview of the workflow
- Searching for related commands.
- Create a folder # mkdir /home/sharedfolder
- Create a group (family)
- Change shared's folder group owner
- Add your users in that group
- Do some testing to see if the default permissions suits you.
1. Searching for related commands
$ apropos -s 1,7,8 groups $ apropos -s 1,7,8 user $ apropos -s 1,7,8 permissions
Commands used
- su (.deb util-linux)
- addgroup (.deb adduser @ )
- chown (.deb coreutils @)
- usermod,groupmod (.deb passwd @)
As wee can see from apropos there are in our system available two commands related to group addition : groupadd and addgroup.(and two commands for user addition useradd,adduser although that doesnt interests us here). Which one should we use?
The man pages help us clarify any confusion. useradd,groupadd are lowlevel distribution agnostic commands part of the passwd deb pkg.
On the other adduser deb package offers : adduser,addgroup which ,according to man pages, are Debian specific frontends to the more distribution agnostic useradd, groupadd and usermod .( that why adduser package depends on passwd package). Adduser's commands are conformant to Debian policies regarding UIDs,GUIDs given (@).
So we'll use the addgroup command since Devuan is a Debian derivative .
2. Create a folder
First you must either 'become' root (using $ su --login) and then create the sharedfolder or ask your system's sysadm with root account to create the sharedfolder.
# mkdir /home/sharedfolder
3. Create a group (family)
# man addgroup
Add a group
If adduser is called with the --group option and without the --system option,
or addgroup is called respectively, a user group will be added.
# /usr/sbin/addgroup family
4. Change shared's folder group owner
# cd /home/ # chown root:family sharedFolder
5. Add your users in that group
Check # man usermod
# /usr/sbin/usermod -a -G family Alec # /usr/sbin/usermod -a -G family Helen
6. Validation & testing
Log in as a user Helen. Change directory to /home/sharerFolder and try create a file. Do the same for Alec.
Helen@familypc:~ $ cd /home/sharedFolder/ Helen@familypc:/home/sharedFolder$ ls Helen@familypc:/home/sharedFolder$ touch test Helen@familypc:/home/sharedFolder$ ls -al
