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.

Seeking for Perl wisdom...on the process of learning...not there...yet!

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

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.