Hello Aldebaran,
Regarding your Q1:
First solution is to ssh as root. You initially need to set ssh-keys as root the same way you did as normal user. For example ($ ssh-copy-id -p 22 <root@hostname or IP>).
On the next step assuming you are root you can modify the file. Alternative solution:
$ ssh -p 22 localhost Welcome to Ubuntu 16.04.5 LTS (GNU/Linux 4.15.0-33-generic x86_64) * Documentation: https://help.ubuntu.com * Management: https://landscape.canonical.com * Support: https://ubuntu.com/advantage 2 packages can be updated. 0 updates are security updates. New release '18.04.1 LTS' available. Run 'do-release-upgrade' to upgrade to it. *** System restart required *** You have new mail. Last login: Wed Sep 12 10:40:51 2018 from 127.0.0.1 user@hostname:~$ sudo su - [sudo] password for user: root@hostname:~#
Update2: I also found (I was not aware) that you might be missing the sudo package. Follow the information on how to install it from here -bash: sudo: command not found.
Regarding Q2 you are referring probably to Limit failed logins to SSH. You can collect the data from the attempts at $ less /var/log/auth.log for Ubuntu servers. If you want to make the server more secure from this type of attacks I would recommend to follow this article Stop SSH brute force attempts. At this point you can have a script checking regularly the file and you can set a condition and in case that something matches your condition, make your script to email you and notify you regarding the attack or to check the file etc... etc...
Update: These are a few lines from my server:
Sep 10 17:39:01 user CRON[28734]: pam_unix(cron:session): session open +ed for user root by (uid=0) Sep 10 17:39:01 user CRON[28734]: pam_unix(cron:session): session clos +ed for user root Sep 10 17:42:31 user sudo: pam_unix(sudo:auth): auth could not identif +y password for [user]
You need to set your own conditions.
Regarding Q3 I do not think that you need CPAN module to do that for you, based on the above information I assume that you can resolve your problems. reading again your question I have not really addressed it. What is the goal once you upload the files to the server? Do you want to execute them, do you want to do something else? We need more information on this.
Unfortunately my answer is not Perl code related but general information regarding ssh and LinuxOS but I think this should cover your question.
If I misunderstood your questions or I have missed a point please let me know and I will try to reply as soon as possible.
Hope this helps, BR.
In reply to Re: using perl on server side for secure connections
by thanos1983
in thread using perl on server side for secure connections
by Aldebaran
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |