Difference between revisions of "Net use"
Jump to navigation
Jump to search
Line 1: | Line 1: | ||
− | Example with smb | + | Example with smb/samba and net use test |
− | + | DOMAIN is your AD/LDAP domain | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | smb.conf | + | # Samba for SMB shares |
+ | /etc/samba/smb.conf | ||
``` | ``` | ||
[myshare] | [myshare] | ||
Line 21: | Line 14: | ||
``` | ``` | ||
− | |||
``` | ``` | ||
− | # | + | systemctl restart smb |
− | sudo setfacl -Rm 'g:DOMAIN\ | + | ``` |
− | # | + | |
− | sudo setfacl - | + | |
− | # remove all | + | # facls |
− | sudo setfacl - | + | |
+ | ## Allow traverse of dir to list directory | ||
+ | ``` | ||
+ | sudo setfacl -m 'g:DOMAIN\sftp_clients_group_rw:x' /sftp/clients | ||
+ | ``` | ||
+ | |||
+ | ## Set perms and defaults for current files/dirs -Rdm (d is for default) | ||
+ | ``` | ||
+ | sudo setfacl -Rm 'g:DOMAIN\sftp_clients_someusergroup_rw:rx' /sftp/clients/someuser | ||
+ | sudo setfacl -Rdm 'g:DOMAIN\sftp_clients_someusergroup_rw:rx' /sftp/clients/someuser | ||
+ | ``` | ||
+ | |||
+ | ## Remove all | ||
+ | ``` | ||
+ | sudo setfacl -Rx 'g:DOMAIN\sftp_clients_someusergroup_rw:rx' /sftp/clients/someuser | ||
+ | sudo setfacl -x 'g:DOMAIN\sftp_clients_group_rw:x' /sftp/clients | ||
+ | # for sure remove all perms | ||
+ | sudo setfacl -x 'g:DOMAIN\sftp_clients_group_rw:rwx' /sftp/clients | ||
+ | ``` | ||
+ | |||
+ | # Map drive and delete | ||
+ | ``` | ||
+ | net use k: \\sftp\myshare /user:DOMAIN\myuser | ||
+ | dir k: | ||
+ | mkdir k:\jtest | ||
+ | rmdir k:\jtest | ||
+ | net use /delete k: | ||
``` | ``` |
Revision as of 00:32, 25 March 2022
Example with smb/samba and net use test
DOMAIN is your AD/LDAP domain
/etc/samba/smb.conf
[myshare] path = /sftp/clients/someuser writeable = yes browseable = no valid users = @"DOMAIN\sftp_clients_group_rw" write list = @"DOMAIN\sftp_clients_group_rw"
systemctl restart smb
facls
Allow traverse of dir to list directory
sudo setfacl -m 'g:DOMAIN\sftp_clients_group_rw:x' /sftp/clients
Set perms and defaults for current files/dirs -Rdm (d is for default)
sudo setfacl -Rm 'g:DOMAIN\sftp_clients_someusergroup_rw:rx' /sftp/clients/someuser sudo setfacl -Rdm 'g:DOMAIN\sftp_clients_someusergroup_rw:rx' /sftp/clients/someuser
Remove all
sudo setfacl -Rx 'g:DOMAIN\sftp_clients_someusergroup_rw:rx' /sftp/clients/someuser sudo setfacl -x 'g:DOMAIN\sftp_clients_group_rw:x' /sftp/clients # for sure remove all perms sudo setfacl -x 'g:DOMAIN\sftp_clients_group_rw:rwx' /sftp/clients
Map drive and delete
net use k: \\sftp\myshare /user:DOMAIN\myuser dir k: mkdir k:\jtest rmdir k:\jtest net use /delete k: