[LINUX] What to do when you want to receive files from a Windows client remotely

What is written

Causes and countermeasures when Permission denied (public key) is said when trying to throw a file from Teraterm on Windows from the remote side to the client side with scp.

Conclusion

What is Permission denied (public key) in the first place?

Permission Denied means that the server is denying the connection for some reason. There seems to be a problem with the public key. However, there seem to be various causes for this error.

Use SCP function of Teraterm itself instead of command

tera_scp_01.jpg

In the first place, Windows OS itself does not have an SCP client like Linux with the same settings, so it seems that it can be handled by using Teraterm's SCP client separately as described above. It seems that the authentication information used when logging in is used as it is.

Use Windows 10 OpenSSH

However, since it seems that there is an OpenSSH client in Windows 10, it is possible to set the Windows standard SSH client, but there is a possibility that it can still be done (I have not tried) The setting method is easy to understand by @ szly, so the following Described in

If the authority of the file you want to send or the authority of the owner is strong, change it with chmod or chown

Symptoms

image.png

Although it can be used for sending a normal text file, I made an authentication key for the client with EasyRSA etc., so when I try to send it to the client, Teraterm's file sending function does not work.

Cause

Looking at the status of the file you want to send with ls -l, it seems that the authority is root.

-rw------- 1 root     root        1696 Jan 27 11:38 authorization.pem

solution

You can send it by changing the authority or administrator so that it can be used even with the authority of the user who logged in with SSH first. Specifically, the permission (authority) is changed with chmod, and the administrator is changed with chown.

1. When supporting with chmod

Let's think about how to deal with the above case. Since root has both user groups, you can call it by setting chmod so that other users can read it.

Refer to the vote below and give 4 to the authority for other users.

symbol Numerical value Corresponding authority
r 4 Readable
w 2 Writable
x 1 Feasible
- 0 No authority
sudo chmod 604 authorization.pem

It is now available for download.

2. When supporting with chown

chown is a command to change the owning user group. At login-user: login-user, you can specify users, groups, and so on. This time I will change both.

sudo chown login-user:login-user authorization.pem

After this, if you send with Teraterm, you can send successfully.

Recommended Posts

What to do when you want to receive files from a Windows client remotely
[AWS] What to do when you want to pip with Lambda
What to do if you get a memory error when converting from PySparkDataFrame to PandasDataFrame
[Linux] When you want to search for a specific character string from multiple files
Let's summarize what you want to do.
What to do when gdal_merge creates a huge file
Links to do what you want with Sublime Text
When you want to play a game via Proxy
When you want to plt.save in a for statement
What to do when you can't bind CaboCha to Python
[Django] A memorandum when you want to communicate asynchronously [Python3]
What to do if you are addicted to Windows character code
What to do when a Remove Error occurs when updating conda
What to do if you can't sort files with subscripts
ImportError: No module What to do when you are told
When you want to hit a UNIX command on Python
Make a note of what you want to do in the future with Raspberry Pi
What to do when Ubuntu crashes
[AWS] What to do when the ping command causes a "timeout"
What to do if you get a minus zero in Python
What to do if you get a UnicodeDecodeError with pip install
What to do when you get "I can't see the site !!!!"
When you want to sort a multidimensional list by multiple lines
[Django] What to do if the model you want to create has a large number of fields
What to do if you get a must override `get_config` error when trying to model.save in Keras
What to do if you get `locale.Error: unsupported locale setting` when getting the day of the week from a date in Python
[Memorandum] What to do when a warning appears after executing pip list
What to do if you get a "Wrong Python Platform" warning when using Python with the NetBeans IDE
When you want to replace a column with a missing value (NaN) column by column
What to do if you get a TypeError with numpy min, max
What to do if you get an error when trying to load mnist
What to do if you get a Permission denied (public key) error when trying to pull on Github
Wrapper when you want to output utf-8 + ansi color on Windows console
[Python] What to do if you get a ModuleNotFoundError when importing pandas using Jupyter Notebook in Anaconda
Q. Do you want to do something like generics that takes value from []?
What to do if fprintd requires a password when registering your fingerprint
When you want a long line break
What to do if you get an error when installing Dlib (Ubuntu)
What to do when a warning message is displayed in pip list
What to do if you get an error when trying to send a message in tasks.loop () immediately after startup
What to do if you get a "No versions found" error in pipenv
What I was addicted to when creating a web application in a windows environment
What to do when a warning appears around Python integration in Neovim's CheckHealth
What to do if Django can't load an image from a static folder
What to do if you get an error when installing python with pyenv
[Python] What to check when you get a Unicode Decode Error in Django
What do you like about how to convert an array (list) to a string?
What to do if you can't pipenv shell
If you want to create a Word Cloud.
When you want to update the chrome driver.
How to remember when you forget a word
What to do when PermissionError of tempfile.mkstemp occurs
I want to do pyenv + pipenv on Windows
What I did when updating from Python 2.6 to 2.7
Do you want me to fix that copy?
What failed when going from Javaer to Pythonista
What to do if you get an OpenSSL error when installing Python 2 with pyenv
What to do if the Microsoft Store opens even if you run python on Windows
What to do if you get an error when importing matplotlib in Python (Mac)
What to do if you get an Import Error when importing matplotlib with Jupyter
What to do if you get the error ʻERR_FEATURE_UNAVAILABLE_ON_PLATFORM` when using ts-node-dev on Linux