From 6a703f9ea71ca73d8dac8777f3ef8e26b8b0d218 Mon Sep 17 00:00:00 2001 From: chudegao Date: Thu, 22 Jan 2015 16:32:03 +0800 Subject: [PATCH] fix 4513 enable root logon permission in remoteshell,4522 support remove os pkgs in ubuntu pkg list --- xCAT-server/lib/perl/xCAT/Template.pm | 2 +- xCAT/postscripts/remoteshell | 11 +++++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/xCAT-server/lib/perl/xCAT/Template.pm b/xCAT-server/lib/perl/xCAT/Template.pm index 84efc787e..09685e22c 100644 --- a/xCAT-server/lib/perl/xCAT/Template.pm +++ b/xCAT-server/lib/perl/xCAT/Template.pm @@ -136,7 +136,7 @@ sub subvars { # append preseed directive lines while () { chomp $_; - if (/^\s*#.*/ ){ + if ((/^\s*#.*/ ) || ( $_ =~ /^-/ )){ next; } $pkglist .= " " . $_; diff --git a/xCAT/postscripts/remoteshell b/xCAT/postscripts/remoteshell index b5778c9df..dc9c14e22 100755 --- a/xCAT/postscripts/remoteshell +++ b/xCAT/postscripts/remoteshell @@ -55,10 +55,13 @@ then sed -i '/MaxStartups /'d /etc/ssh/sshd_config echo "MaxStartups 1024" >>/etc/ssh/sshd_config - if [ "$SETUPFORPCM" = "1" ];then - sed -i '/PasswordAuthentication /'d /etc/ssh/sshd_config - echo "PasswordAuthentication yes" >>/etc/ssh/sshd_config - + if [ "$SETUPFORPCM" = "1" ]; then + if [[ $OSVER == sles* ]];then + sed -i '/PasswordAuthentication /'d /etc/ssh/sshd_config + echo "PasswordAuthentication yes" >>/etc/ssh/sshd_config + elif [[ $OSVER == ubuntu* ]];then + sed -i 's/^PermitRootLogin.*/PermitRootLogin yes/' /etc/ssh/sshd_config + fi fi fi