LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Blogs > baig
User Name
Password

Notices



  1. Old Comment

    Setting up ssh key authentication

    Quote:
    Originally Posted by gharvey View Comment
    Doesn't work. =(

    Fedora 10 client to CentOS 5 server ... followed the instructions to the letter. No errors, no problems reported, but still challenged for a password.

    Checked my local id_rsa.pub file against authorized_keys on the server and they are identical. Checked and re-checked the sshd config file, as above. Again, no problems.

    Restarted sshd many times.

    Still it asks me for a password. Anyone got any suggestions?? =(
    Worked in the end. Problem was *local* settings. I didn't use the default file name for the keys, I made my own, and that meant the *local* client didn't know where the private key was.

    If you think you might have the same situation, do this to check:

    Code:
    ssh -i .ssh/your_private_key user@remote_host
    If that works, add your key file to /etc/ssh/ssh_config like this:

    Code:
    IdentityFile /path/to/your/key
    Posted 06-05-2009 at 05:44 AM by gharvey gharvey is offline
  2. Old Comment

    Setting up ssh key authentication

    Doesn't work. =(

    Fedora 10 client to CentOS 5 server ... followed the instructions to the letter. No errors, no problems reported, but still challenged for a password.

    Checked my local id_rsa.pub file against authorized_keys on the server and they are identical. Checked and re-checked the sshd config file, as above. Again, no problems.

    Restarted sshd many times.

    Still it asks me for a password. Anyone got any suggestions?? =(
    Posted 06-05-2009 at 05:24 AM by gharvey gharvey is offline
  3. Old Comment

    Setting up ssh key authentication

    Update.

    When i tried
    Quote:
    ssh-copy-id
    command to copy pub key to server while it was listening on a non standard port 2323.. it gave some errors.. I configured my server to prot 22 and it worked fine..

    Cheers!!
    Posted 01-12-2009 at 05:27 AM by baig baig is offline
  4. Old Comment

    My Journy of Shell Scripting

    A two lined script to keep you awair of an attack.!!

    @above:First of all thanks for you improved script.

    To control your computer over internet ssh is used secure shell, which lets a user/hacker to login to your computer by entering password. These events are logged into /var folder and its pretty hard for a beginner to sort it out..
    I know many of us don't know where to search for such logs to see who has attempt and when..

    The safest why, if you are sure you don't need ssh service ... stop it from services.

    To get daily report automatically to your specified directory follow the steps:
    logdir is Fedora default log route
    Code:
    mkdir /root/SSH_attempts
    Code:
    vim checkssh.sh
    ***once you copy paste the code from below****
    chmod 755 checkssh.sh
    ######################################
    ######FOR BEGINNERS###################
    ######################################

    #!/bin/sh

    cat /var/log/secure | grep "Failed password"|sort -n>/root/SSH_attempts/sshfailattempts.log
    cat /var/log/secure | grep "Accepted password"|sort -n>/root/SSH_attempts/sshsuccessattempts.log


    save this script under root

    Start you cron service if not started.

    type

    Code:
    crontab -e
    1 * * * * /root/checkssh.sh

    save and exit..

    now you will have update to your folder SSH_attempts
    with two logfiles..

    one for failed attempts.
    send for success attempts.

    Cheers!!
    Posted 12-04-2008 at 07:44 AM by baig baig is offline
    Updated 12-04-2008 at 07:45 AM by baig
  5. Old Comment

    My Journy of Shell Scripting

    I added some usable features to the previous script.
    Support now also main idea of *nix:
    - software use stdin+stdout+stderr, caller can change
    it
    You can call xxx.sh -s from/here -d to/location -n usingname

    More error checking, exit if error

    -----------------------------------------------
    Quote:
    #!/bin/bash
    # this script is posix-sh compatible, you can use ksh,bash,posix-sh, ....
    # chmod a+rx this.sh
    # ./this.sh

    # save script name
    PRG=$0
    # ksh/bash/posix compatible echo no newline version
    ASK="echo -e -n"
    # logfile
    logf="backuplog.log"
    # init variable
    name=""
    save=""
    take=""

    ########################### function ###########################
    usage()
    {
    cat <<-EOT >&2
    usage:$PRG -s dir -d dir -n name
    EOT
    [ $# -gt 0 ] && exit $*
    }

    ############################ main ##############################
    # - look cmdline options
    while [ $# -gt 0 ]
    do
    flag="$1"
    case "$flag" in
    -s) # source dir
    take="$2"
    shift
    ;;
    -d) # destdir
    save="$2"
    shift
    ;;
    -n) # name
    name="$2"
    shift
    ;;
    --) break ;; # - no more options
    -*) usage 99 ;;
    *) # no arguments, so error
    usage 99
    ;;
    esac
    shift
    done

    # HERE is nice "template" method
    cat <<EOT
    ================================================================================
    ===============================Back Up Utility==================================
    ================================================================================
    $(date '+%Y-%m-%d') == $(hostname) == $(id -u -n) ==
    $take -> $save ($name)
    EOT

    if [ "$name" = "" ] ; then
    $ASK "Enter name of back up Date/month/year will be added automaticaly: "
    read name
    fi
    [ "$name" = "" ] && exit 2

    if [ "$take" = "" ] ; then
    $ASK "Enter path to take backup of: "
    read take
    fi
    [ "$take" = "" ] && exit 3

    if [ ! -d "$take" ] ; then # - dir ?
    # error redirect to the stderr
    echo "$take is not a valid Directory: usage: e.g: /root, /boot e.t.c " >&2
    cat <<-EOT >> $logf
    Back up of directory *** $take *** Failed at $(date '+%Y-%m-%d-------%r')


    EOT
    exit 1
    fi

    if [ "$save" = "" ] ; then
    $ASK "Enter path to save backup in: "
    read save
    fi
    [ "$save" = "" ] && exit 4

    mkdir "$save" >/dev/null 2>&1 # -make if needed

    if [ ! -d "$save" ] ; then # - dir ?
    echo "no $save dir ???" >&2
    exit 5
    fi

    # using ex. variables give more readable code
    bfile="$save/${name}_$(date '+%Y%m%d.%H%M%S').tgz"

    if tar -zcf "$bfile" "$take"
    then
    cat <<-EOT >> $logf
    Backup of **** $take *** was taken Successfully to Dir:$save


    EOT
    else
    echo "tar error" >&2
    fi
    Posted 12-04-2008 at 02:40 AM by kshfi kshfi is offline
  6. Old Comment

    My Journy of Shell Scripting

    Take an easy Backup!!

    Am absolutely free due to my university vacation and I'm loving spending hours and hours learning Linux... So what I learned to day so far is:

    Same steps mentioned above in previous post, to make it work. Copy paste to vim, change mode and execute..

    Description:

    Takes back of specified path to a specific directory.

    Reports completion status to logfile..

    --------------copy form below-------------


    #! /bin/bash

    clear
    echo "================================================================================"
    echo "===============================Back Up Utility=================================="
    echo "================================================================================"

    echo "Enter name of back up Date/month/year will be added automaticaly: "
    read name

    echo "Enter path to take backup of: "
    read take

    if [ -d $take ];then
    echo "Enter path to save backup in: "
    read save
    else
    echo "$take is nota a valid Directory: usage: e.g: /root, /boot e.t.c "
    echo "Back up of directory *** $take *** Failed at `date +%d-%m-%y-------%r`">>backuplog.log
    echo "">>backuplog.log
    echo "">>backuplog.log
    echo "">>backuplog.log
    exit 1
    fi


    tar -zcf $save/"${name}_`date +%d-%m-%y`.tgz" $take

    if [ $? -eq 0 ]
    then
    echo "Backup of **** $take *** was taken Successfully to Dir:$save">>backuplog.log
    echo "">>backuplog.log
    echo "">>backuplog.log
    fi


    -----------script ends-------------------

    you can change the logging path to your taste..

    Love Linux, Live Linux

    Cheers!!
    Posted 12-03-2008 at 04:14 PM by baig baig is offline
    Updated 12-03-2008 at 04:16 PM by baig
  7. Old Comment

    My Journy of Shell Scripting

    easy Yam usage!!

    This is my second script!! I think it would be help full for those who don't want to end up in confusion using yum...

    In order to make download only work...you will have to download the plugin first...

    begin root or sudo. type

    Code:
    yum install yum-downloadonly.noarch -y
    For Newbies...

    Code:
    vim easyyum.sh
    #-----------copy from below------------

    #! /bin/bash

    clear

    echo "Type the starting name of package to list all avaialable: "
    read package


    yum list all | grep $package |sort|less


    echo "Copy and paste the required package(s) from above.. Paste below and hit enter: "
    read ins

    echo "Want to directly install(0) or download to directory(1):enter 1 or 0"
    read op;

    if [ $op -eq 1 ]; then
    echo "Enter directory to download: e.g (/root/, /home/user/ etc "
    read dir
    yum install $ins --downloadonly --downloaddir=$dir
    else
    yum install $ins
    fi

    echo "Done!!!"

    #---------------copy till here----------
    #Script ends..

    Now save and exit.. press esc twice and then type

    Code:
    :wq
    now change mode of script.. type

    Code:
    chmod 755 easyyum.sh
    you are done...

    now..

    Code:
    cd to_directory_where_easyyum.sh is
    then finally

    Code:
    sh easyyum.sh

    run it as root or sudo..

    Cheers!!
    Posted 12-02-2008 at 06:15 AM by baig baig is offline
    Updated 12-02-2008 at 07:45 AM by baig

  



All times are GMT -5. The time now is 12:06 AM.

Main Menu
Advertisement

Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration