> For the complete documentation index, see [llms.txt](https://www.netexec.wiki/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://www.netexec.wiki/nfs-protocol/download-and-upload-files.md).

# Download and Upload Files

{% hint style="info" %}
For `` `--chmod` `` you need to specify the export share with `--share` if you do not want to use the root fs escape method (see [escape to root file system](/nfs-protocol/escape-to-root-file-system.md)).
{% endhint %}

Files in NetExec are uploaded with \`777\` permissions by default. To change these permissions you can use the \`--chmod\` flag:

<figure><img src="/files/xIFXAVyDm2qCIwuZWVnf" alt=""><figcaption></figcaption></figure>

Example usage:

```bash
# Share name is "/home/user/Desktop/NFSShare"
nxc nfs <ip> --share /home/user/Desktop/NFSShare/ --get-file as.txt as.txt

# Example Output                                                          
NFS         <ip>  <nfs_port>  <ip>   [*] Supported NFS versions: (3, 4) (root escape:True)
NFS         <ip>  <nfs_port>  <ip>   [*] Downloading as.txt to as.txt
NFS         <ip>  <nfs_port>  <ip>   File successfully downloaded from as.txt to as.txt

nxc nfs <ip> --share /home/user/Desktop/NFSShare/ --put-file aa.txt aa.txt

# Example Output                                                          
NFS         <ip>  <nfs_port>  <ip>   [*] Supported NFS versions: (3, 4) (root escape:True)
NFS         <ip>  <nfs_port>  <ip>   [*] Uploading from aa.txt to aa.txt
NFS         <ip>  <nfs_port>  <ip>   [*] Trying to create aa.txtaa.txt
NFS         <ip>  <nfs_port>  <ip>   [+] aa.txt successfully created
NFS         <ip>  <nfs_port>  <ip>   [+] Data from aa.txt successfully written to aa.txt with permissions 777
NFS         <ip>  <nfs_port>  <ip>   File aa.txt successfully uploaded to aa.txt
```

### Download File

Example usage:

```bash
nxc nfs <ip> --get-file /home/user/Desktop/test/test.txt test.txt

# Example Output                                                          
NFS         <ip>  <nfs_port>  <ip>   [*] Supported NFS versions: (3, 4) (root escape:True)
NFS         <ip>  <nfs_port>  <ip>   [*] Downloading /home/user/Desktop/test/roottest.txt to roottest.txt
NFS         <ip>  <nfs_port>  <ip>   File successfully downloaded to test.txt from /home/user/Desktop/test/test.txt

```

### Upload File

Uploaded files are created with chmod **777** permissions (this can be changed with [\`--chmod\`](/nfs-protocol/chmod.md)). If folders in the specified path do not exist yet, they will be created as well. Example usage:

```bash
nxc nfs <ip> --put-file test2.txt /home/user/Desktop/

# Example Output                                                          
NFS         <ip>  <nfs_port>  <ip>   [*] Supported NFS versions: (3, 4) (root escape:True)
NFS         <ip>  <nfs_port>  <ip>   [*] Uploading from test2.txt to /home/user/Desktop/NFSShare/
NFS         <ip>  <nfs_port>  <ip>   [*] Trying to create /home/user/Desktop/NFSShare/test2.txt
NFS         <ip>  <nfs_port>  <ip>   [+] test2.txt successfully created
NFS         <ip>  <nfs_port>  <ip>   [*] Trying to write data from test2.txt to /home/user/Desktop/NFSShare/
NFS         <ip>  <nfs_port>  <ip>   [+] Data from test2.txt successfully written to /home/user/Desktop/NFSShare/
NFS         <ip>  <nfs_port>  <ip>   File test2.txt successfully uploaded to /home/user/Desktop/NFSShare/

```

**If the local file already exists on the remote server, NetExec asks whether you want to overwrite it.**

```bash
nxc nfs <ip> --put-file test2.txt /home/user/Desktop/

# Example Output  
NFS         <ip>  <nfs_port>  <ip>   [*] Supported NFS versions: (3, 4) (root escape:True)
NFS         <ip>  <nfs_port>  <ip>   [*] Uploading from test2.txt to /home/user/Desktop/NFSShare/
[!] test2.txt already exists on /home/user/Desktop/NFSShare/. Do you want to overwrite it? [Y/n] Y
NFS         <ip>  <nfs_port>  <ip>   [*] test2.txt already exists on /home/user/Desktop/NFSShare/. Trying to overwrite it...
NFS         <ip>  <nfs_port>  <ip>   [*] Trying to write data from test2.txt to /home/user/Desktop/NFSShare/
NFS         <ip>  <nfs_port>  <ip>   [+] Data from test2.txt successfully written to /home/user/Desktop/NFSShare/
NFS         <ip>  <nfs_port>  <ip>   File test2.txt successfully uploaded to /home/user/Desktop/NFSShare/
```
