Issue with SSH Keys [closed] - linux

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 2 years ago.
Improve this question
I'm having something very similar to: SSHD Gives error could not open Authorized Keys, although permissions seem correct
but not exactly the same thing.
When I try to connect to server with my user account I see the following error message in /var/log/secure
The error message says:
Could not open authorized keys '/home/<username>/$HOME/.ssh/authorized_keys': No such file or directory
which makes perfect sense, but when I go to the /etc/ssh/sshd_config folder to see where the sshd service should look for my authorized key folder it shows $HOME/.ssh/authorized_keys so i'm not sure why SSH is trying to append my /home/<username> to $HOME/.ssh/authorized_keys. I did double check and ran the following cmd: echo $HOME just to make sure $HOME wasn't set improperly. If anyone has any ideas it would be much appreciated.

sshd_config is not a shell script. $HOME/.ssh/authorized_keys is taken as a literal path, and since it does not start with /, it is appended to the user's home directory.
You should replace $HOME with the token that sshd interprets as the user's home directory, or simply use the relative path .ssh/authorized_keys (which, by the way, is the default).
AuthorizedKeysFile %h/.ssh/authorized_keys

Related

How can I edit a file with copies in 2 different users in linux? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 2 years ago.
Improve this question
I use AWS vps server and apache2 is installed in it. I want to edit a file "index.html" from 2 different accounts (i.e. 1st user "ubuntu" and second user "www-data"). By now, I try to edit the file but I got permission error so first I change (chown) permission to "ubuntu " and edit file and again change (chown) permission back to "www-data" otherwise I will get permission error in web browser.
I used chmod 777 index.html but this didn't help.
Please help me finding some good solution. Because this is tough to edit. I do have sudo permission if needed.
Thanks in advance!
You have two options:
create a dedicated group and add the ubuntu and www-data users to this group. Then set with chgrp the group of the file and finally give the right permissions to the group with chmod.
If your server suports Access Control Lists (it should), you could use the setfacl command. You can read about the command here and here.

How to grant permissions to VS Code to modify files in Windows Subsystem for Linux [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 3 years ago.
Improve this question
I connected VS Code to WSL and when I try to save changes in my index.php file the following message shows up.
I tried to change the permissions on var/www/html using chmod but nothing changed.
So how to make VS code modify the file?
Even I faced the same issue on my linux system, following command solved it:
Go to that directory from terminal.
Write sudo chown -R <username>:<group> <directory_name>. This command will change ownership (both user and group) of all files and directories inside of directory and directory itself.
To know the username write whoami in terminal.
To know the group write groups in terminal (The first name in the list is your group name) for me both username and groupname was same.
Open VS Code with Root User permission.

SCP: file not found when trying to copy from windows to linux server [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 7 years ago.
Improve this question
In putty i want to copy a .war file from my machine (at D:\\file.war) to a remote server like this:
sudo scp -r D://file.war user#xxx.xxx.xxx.xxx:/tomcat8/webapps
it doesn`t work and i have also tried things like:
sudo scp -r \file.war user#xxx.xxx.xxx.xxx:/tomcat8/webapps
or
sudo scp -r /cygdrive/d/file.war user#xxx.xxx.xxx.xxx:/tomcat8/webapps
I have to type in my password two times then (one time for sudo, next time for user). But then i get always the same error:
<pathtolocalfile>: No such file or directory
Putty always connects via SSH. I need sudo to get permission to write into the webapps folder.
How do i have to specify the path? Sry, i´m trying this for the first time and after some research i´m getting more and more confused about how to do this the right way.
I managed to do what i wanted, although my solution is not the nicest:
I connected to the server using WinSCP and my normal user account.
There i copied the file into my user home directory.
Then i opened the Putty console in WinSCP and changed to root user with "sudo" (and typing in my password again).
Now i finally was able to copy the file from my user accounts home directory into the webapps folder of tomcat.

How to copy files from one linux server to other linux server account? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 8 years ago.
Improve this question
I like to ask how am I going to copy files from one of my Linux Server Account to other account? If anyone knows how, please help me.
Take a look at the man pages for scp. This is a very useful command that I use rather often at my job.
It works easiest if you are logged into the server that has the file you want to transfer (IMO). The syntax is scp src_file username#remote_host:dst_file, where the text that comes after the : in the second part is the destination path on the other server.
For example, if you have a file called "file.txt" on server1, and you want to put it on server2, you would type:
scp file.txt username#server2.name.or.ip:/home/other_username
or where ever you want to put the file. I would recommend copying the file first to your home directory on the other server as that minimizes issues with permissions, in my experience.
EDIT: If you want to log into the server that is going to receive the file, you can just swap the first and second arguments to copy from the remote server to the local one.

How to install a program in linux for all users not only for root? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 8 years ago.
Improve this question
I installed the shrewsoft vpnmanger on my linux (crunchbang kernel 3.2.0-4 amd64) the problem is, that somehow it can only be started as sudo. Can someone explain how i can fix this?
sudo /usr/local/sbin/iked&
How can I change the iked installation so that it is available for each user?
Thanks
It's just about the paths a normal user's shell search for commands. But normally it makes sense that those commands located in a sbin dir are not accessible by typing just the command's name. Those commands need access to protected resources that are only accessible by root.
But if you have the luck that you can gain the full rights by means of sudo you can simply create an alias via
alias iked="sudo /usr/local/sbin/iked"
and add it into your shell's resource file.
To make the full command accessible to all users by simply typing iked you can create a little bash script named iked with content
#!/bin/bash
sudo /usr/local/sbin/iked
and place it in /usr/local/bin.
Of course that implies an appropriate /etc/sudoers file and that the execute permission of iked is set.
try copying or symlinking in it in /usr/bin.
and see if it work for the user then, if it has a global log file (I don't know about this app so not one to comment) but assuming it has some log in /var/log/iked.log and its been written by root you will have permssion issues by another user, so chown it to some neutral group like users or something.:
Try here it may give you more info, I can see you could try:
/usr/bin/iked -d 4
But from what I read it does have a log in /var/log and yep that permission issue would be the primary issue specially if root was the first user to run this app.

Resources