File management: Difference between revisions

From Han Wiki
Jump to navigation Jump to search
→‎Setting a default group for a folder: add group ownership update command
add a section on making a samba share
Line 1: Line 1:
== Making a samba share ==
* ''Last tested on Ubuntu 16.04 LTS (xenial) & Windows 10.0.10586''
at the end of <span class="shell">/etc/samba/smb.conf</span> add a share config.
<source lang="properties">
[ed]
        comment = pistis - echo admin
        path = /var/www/ea
        admin users = mhan
        read only = No
        create mask = 0755
</source>
then add the Samba account.
<source lang="bash">
$ sudo smbpasswd -a mhan
</source>
then restart samba
<source lang="bash">
$ sudo systemctl restart smbd.service nmbd.service
</source>
then on Windows execute the following. For the username, you may have to enter it in the form <span class="package">mhan@pistis</span> or <span class="package">pistis\mhan</span>. Enter the password you used when you added the Samba account for the user.
<source lang="doscon">
C:\>net use Z: \\pistis\ea /savecred /persistent:yes
</source>
== Copy including hidden files ==
== Copy including hidden files ==
* ''Last tested on Ubuntu 14.04.2 LTS (trusty)''
* ''Last tested on Ubuntu 14.04.2 LTS (trusty)''
<source lang="bash">
<source lang="bash">
$ cp -r folder1/. target/
$ cp -r folder1/. target/
</source>
</source>


== Setting a default group for a folder ==
== Setting a default group for a folder ==
Line 35: Line 70:
$ sudo chmod g+s /srv/www/project
$ sudo chmod g+s /srv/www/project
</source>
</source>


[[Category:System administration]]
[[Category:System administration]]

Revision as of 21:45, 6 June 2016

Making a samba share

  • Last tested on Ubuntu 16.04 LTS (xenial) & Windows 10.0.10586

at the end of /etc/samba/smb.conf add a share config.

[ed]
        comment = pistis - echo admin
        path = /var/www/ea
        admin users = mhan
        read only = No
        create mask = 0755

then add the Samba account.

$ sudo smbpasswd -a mhan

then restart samba

$ sudo systemctl restart smbd.service nmbd.service

then on Windows execute the following. For the username, you may have to enter it in the form mhan@pistis or pistis\mhan. Enter the password you used when you added the Samba account for the user.

C:\>net use Z: \\pistis\ea /savecred /persistent:yes

Copy including hidden files

  • Last tested on Ubuntu 14.04.2 LTS (trusty)
$ cp -r folder1/. target/


Setting a default group for a folder

  • Last tested on Ubuntu 16.04 LTS (xenial)

This is to set permission for an existing folder for collaboration. This assumes the group name to be dev, and the folder to be /srv/www/project.

This sets setgid bit on the folder.

$ sudo find /srv/www/project -type d -exec chgrp dev {} +
$ sudo find /srv/www/project -type d -exec chmod g+s {} +

Make it writable by the group.

$ sudo chmod -R g+w /srv/www/project

Change group ownership of existing files.

$ sudo chown -R mhan:dev /srv/www/project

These commands should be executed for a new folder.

$ sudo chgrp dev /srv/www/project
$ sudo chmod g+s /srv/www/project