How to Fix “scp: not a regular file”?

The SCP (Secure. Contain and protect) utility is used for copying the files in the system over the network. It copies the files/directories locally such as from one directory to another or to the remote hosts or in between the two remote hosts. While copying the files from any host to the computer, you may face the error “scp: not a regular file” because the syntax is not being followed properly.

This post will describe the reasons and solutions for the error “scp: not a regular file”.

Reason: Source Path Not Specified

The reason for this error is that the user has provided the “root@IP:” as the source file, i.e., the user home directory. The users can give the home directory as a destination but not as a source file. 

The following snippet shows an error, where the source path is not specified: 

$ scp Henry@ubuntu: /home/itslinuxfoss/file.txt

Solution: Specify the Source Path and Copy the Files Recursively

The solution for this error is that, use the below syntax for copying the files:

$ scp -r root@IP/Hostname:/path/to/file /path/to/filedestination

Write the “scp”, “r” flag for recursively copying the files, and type the hostname/IP with the source path to the file. Then, type the destination path where the file will be placed.


The below command will copy the “file.txt” file from the “information” directory of the remote host “Henry@ubuntu”. Then paste it into the “example” directory of the current machine:

$ sudo scp -r Henry@ubuntu:information/file.txt /example

The file from the remote host has been copied successfully


The reason for the error “scp: not a regular file” is that the source path is not specified while copying the file. To fix this error, use the correct syntax of the “scp” command, specify the source path, and copy the file recursively. 

This post has covered the reason and the solution for the error “scp: not a regular file”.