$ sudo cat >> /usr/bin/nova-ssh  << END

FIRST=$1

IDX=`expr index $1 "@"`
if [[ $IDX  == "0" ]] ; then
    echo "please input the user name"
    exit 1
fi
USER=${FIRST%@*}

IP=${FIRST#*@}
NINFO=`nova list | grep $IP | awk '{print $12}'`
NID=${NINFO%=*}
PIP=${NINFO#*=}
PIP=${PIP%,}
NAME=`nova list | grep $IP |awk '{print $4}'`
echo "VM name: $NAME"
if [ -z $NID ]; then
    echo "invalid $IP"
    echo "not find the network id of $IP for $NAME"
    exit 1
fi

NS=`nova network-show $NID | grep "|\s\+id\s\+|"`
NS=${NS%|}
NS=${NS/|*id*| /qdhcp-}
shift
echo "login $USER@$PIP, it will take some time..."
sudo ip netns exec $NS ssh "$USER@$PIP" $@ -i $HOME/.ssh/id_rsa

END

$ sudo chmod a+x /usr/bin/nova-ssh

$ #  nova-ssh user@private_ip/id/name

$ nova-ssh minion@3a76ccfc-fc55-4102-8848-fa62003110be

ssh login nova vm的更多相关文章

  1. Fixing ssh login long delay

    原文:http://injustfiveminutes.com/2013/03/13/fixing-ssh-login-long-delay/ For a long time I had a prob ...

  2. SSH login without password

    SSH login without password Your aim You want to use Linux and OpenSSH to automize your tasks. Theref ...

  3. Security configuration of SSH login entry - enterprise security practice

    catalog . 引言 . 修改ssh端口 . 禁用root远程ssh登录 . 只使用SSH v2 . 限制用户的SSH访问 . 禁用.rhosts文件 . 禁用基于主机的身份验证 . 基于公私钥的 ...

  4. OpenStack nova VM migration (live and cold) call flow

    OpenStack nova compute supports two flavors of Virtual Machine (VM) migration: Cold migration -- mig ...

  5. Passwordless SSH Login

    原文地址:http://manjeetdahiya.com/2011/03/03/passwordless-ssh-login/ Consider two machines A and B. We w ...

  6. hadoop-0.20-集群搭建___实体机通过SSH访问基于VM安装的Linux

    不得不说LZ在最开始搭建hadoop的时候,由于VM中的网段配置和本地IP地址没有配置好, 所以一直都在使用 VM的共享文件夹的功能, 以至于集群搭建好之后,只有namenode主机可以实现共享的功能 ...

  7. 3 Steps to Perform SSH Login Without Password Using ssh-keygen & ssh-copy-id

    http://www.thegeekstuff.com/2008/11/3-steps-to-perform-ssh-login-without-password-using-ssh-keygen-s ...

  8. 【转载】SSH login without password 免密登陆

    Your aim You want to use Linux and OpenSSH to automate your tasks. Therefore you need an automatic l ...

  9. putty ssh login linux

    (1) in linux $ ssh-keygen -t dsa $ cd .ssh $ cat id_dsa.pub > authorized_keys $ chmod 600 authori ...

随机推荐

  1. smarty的简单介绍

    我们可以看到,smarty的程序部分实际就是符合php语言规范的一组代码,我们依次来解释一下:1./**/语句: 包含的部分为程序篇头注释.主要的内容应该为对程序的作用,版权与作者及编写时间做一个简单 ...

  2. 这些年,我收集的JavaScript代码(一)

    一.取URL中的参数 function getParameterByName(name) { var match = RegExp('[?&]' + name + '=([^&]*)' ...

  3. 了解单位em和px的区别

    这里引用的是Jorux的“95%的中国网站需要重写CSS”的文章,题目有点吓人,但是确实是现在国内网页制作方面的一些缺陷.我一直也搞不清楚px与em之间的关系和特点,看过以后确实收获很大.平时都是用p ...

  4. Mindjet 一打开鼠标就动不了解决方法

    在网上查找了一下相关资料,这个主要是Mindjet不支持64位系统造成的,其实就和Windows tablet pc input 这个服务相冲突造成的,临时的解决方法是,win+r (别告诉我你不知道 ...

  5. Final Exam Arrangement(ZOJ)

    In Zhejiang University, there are N different courses labeled from 1 to N. Each course has its own t ...

  6. 复习day12-23

    获取请求中的内容: request.getParameter(); get方式因为在地址栏所以需要转码: String name = new String(req.getparameter().get ...

  7. Yii的场景

    先上代码 class User extends CActiveRecord{    public function rules()    {        return array(          ...

  8. 关于写的Java书籍进展

    大家好,去年说要写本Java书,近期就快出版了.眼下已经開始打印样书了,最快于本月中旬左右就能够在互动网www.china-pub.com上看到消息,其它各个站点何时会发售要看详细进货情况. 去年我预 ...

  9. THP Transparent HugePages 相关知识与关闭

    近期遇到个LINUX系统内存比較大.未开 HugePages,业务有变化导致ORACLE连接数剧增至上千个,PageTables达到上百G.导致内存不足系统HANG住的案例. 因此须要开启 HugeP ...

  10. Android编程之LayoutInflater的inflate方法具体解释

    LayoutInflater的inflate方法,在fragment的onCreateView方法中经经常使用到: public View onCreateView(LayoutInflater in ...