Shares

Enumerate

Samba (Windows Shares)

smbclient -L <server_name>

Lists shares available on a specific Windows server.

smbclient -L //<hostname>

List available SMB/CIFS shares on a remote Samba server (replace <hostname> with the server's hostname or IP address).

netstat -tuln

Display listening network services and ports. Look for services like NFS (port 2049) or Samba (ports 137-139 and 445).

nmap -p 139,445 <network_range>

Scans a network range for active Samba servers (requires nmap installation).

smbmap

Lists shares from multiple servers based on /etc/samba/smb.conf configuration.

NFS (Network File System)

mount

List currently mounted filesystems, including network shares like NFS and CIFS/SMB.

showmount -e

Lists NFS exports (shared directories) from accessible NFS servers.

showmount -e <hostname>

List NFS shares available on a remote NFS server (replace <hostname> with the server's hostname or IP address).

rpcinfo -p mountd <server_name>

Checks NFS availability on a specific server.

nfsstat -s

Shows mounted NFS shares on the local system. (client perspective)

nfsstat -m

Show NFS-mounted filesystems on the local system.

findmnt -t nfs -t cifs

List mounted NFS and CIFS filesystems.

WebDAV Shares

curl -I <URL>

Checks the headers of a URL to see if it's a WebDAV server.

davfs2

Mounts WebDAV shares as local directories (tool) (requires installation).

Modify

NFS (Network File System)

Create an NFS Export

Modify the /etc/exports file to specify which directories to export and the access permissions. Example: sudo nano /etc/exports Add an entry like: /shared_directory 192.168.1.0/24(rw,sync,no_root_squash)

Restart NFS Server

Reload or restart the NFS server to apply changes. Example: sudo systemctl restart nfs-server

Mount an NFS Share

Use the mount command to connect to an NFS share. Example: sudo mount -t nfs <server_ip>:/shared_directory /mnt/mount_point

Samba (SMB/CIFS)

Install Samba

Ensure Samba is installed on your system. Example (on Debian/Ubuntu): sudo apt-get install samba

Create a Samba Share

Create a share on a Samba server (requires administrative privileges): smbcontrol server <server_name> share add <share_name> <path>

Export a directory on your system as an NFS share (requires administrative privileges): export <path>

AND/OR

Modify the Samba configuration file (smb.conf) to define your shares. sudo nano /etc/samba/smb.conf Add an entry like:

[MyShare]
path = /shared_directory
read only = no

Set Samba Passwords

Create a Samba user and set the password. Example: sudo smbpasswd -a <username>

Restart Samba

Restart the Samba service to apply changes. Example: sudo systemctl restart smbd

Connect to a Samba Share

Use the smbclient command to connect to a Samba share interactively. smbclient //<server_ip>/MyShare -U <username>

Connect to a share for editing files. Requires appropriate permissions: smbclient -U <server_name>/<share_name>

Mount a Samba Share (CIFS)

Use the mount command to mount a Samba share to a local directory. Example: sudo mount -t cifs -o username=<user>,password=<password> //<server_ip>/MyShare /mnt/mount_point

Mount a share temporarily: smbmount //<server_name>/<share_name> /mnt/sharepoint

Mounts a share permanently using credentials: mount.cifs //<server_name>/<share_name> /mnt/sharepoint -o username=<user>,password=<password>

WebDAV

Modifying

Mount a WebDAV share as a local directory for editing files (requires the davfs2 package): davfs2 /url/to/webdav /mnt/sharepoint

Creating

WebDAV servers usually have web interfaces for creating shares. Consult the server's documentation.

Connecting

Same as modifying.

Last updated

Was this helpful?