# Server Message Block (SMB)

## Windows

<kbd>WINKEY</kbd> + <kbd>R</kbd> and type the file share location, e.g.: `\\192.168.220.129\Finance\`

<figure><img src="https://1261483422-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FTAjoMGhyi4qD4wiYqHYf%2Fuploads%2FTUH45LHhvPidPj0DUNrn%2Fwindows_run_sharefolder2.jpg?alt=media&#x26;token=f2623f11-1feb-483f-9aca-291286d6d618" alt=""><figcaption></figcaption></figure>

### CMD

```shellsession
dir \\192.168.220.129\Finance\
```

Connect to a file share and map its content to the drive letter `n`

```shellsession
net use n: \\192.168.220.129\Finance
net use n: \\192.168.220.129\Finance /user:plaintext Password123
```

### PowerShell

```powershell
# instead of dir
Get-ChildItem \\192.168.220.129\Finance\
# instead of net use
New-PSDrive -Name "N" -Root "\\192.168.220.129\Finance" -PSProvider "FileSystem"
N:
# with username and password
PS C:\htb> $username = 'plaintext'
PS C:\htb> $password = 'Password123'
PS C:\htb> $secpassword = ConvertTo-SecureString $password -AsPlainText -Force
PS C:\htb> $cred = New-Object System.Management.Automation.PSCredential $username, $secpassword
PS C:\htb> New-PSDrive -Name "N" -Root "\\192.168.220.129\Finance" -PSProvider "FileSystem" -Credential $cred
N:
```

## Linux

```bash
sudo mkdir /mnt/Finance
sudo mount -t cifs -o username=plaintext,password=Password123,domain=. //192.168.220.129/Finance /mnt/Finance
# or using a credential file
mount -t cifs //192.168.220.129/Finance /mnt/Finance -o credentials=/path/credentialfile
```

Credential file

```
username=plaintext
password=Password123
domain=.
```
