( ! ) Warning: "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? in /var/www/vhosts/shan.info/httpdocs/templates/gk_publisher/lib/menu/GKBase.class.php on line 114
Call Stack
#TimeMemoryFunctionLocation
10.0022413952{main}( ).../index.php:0
20.16894264512Joomla\CMS\Application\SiteApplication->execute( ).../index.php:49
30.792615926376Joomla\CMS\Application\SiteApplication->render( ).../CMSApplication.php:202
40.792915926432Joomla\CMS\Application\SiteApplication->render( ).../SiteApplication.php:778
50.792915926808Joomla\CMS\Document\HtmlDocument->parse( ).../CMSApplication.php:1030
60.792915926808Joomla\CMS\Document\HtmlDocument->_fetchTemplate( ).../HtmlDocument.php:545
70.793115926904Joomla\CMS\Document\HtmlDocument->_loadTemplate( ).../HtmlDocument.php:730
80.798015965144require( '/var/www/vhosts/shan.info/httpdocs/templates/gk_publisher/component.php' ).../HtmlDocument.php:668
90.812216257088GKTemplate->__construct( ).../component.php:31
100.824716410968GKTemplateMenu->getMenuType( ).../gk.framework.php:84
110.826016454936require_once( '/var/www/vhosts/shan.info/httpdocs/templates/gk_publisher/lib/menu/GKMenu.php' ).../helper.menu.php:19

( ! ) Warning: "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? in /var/www/vhosts/shan.info/httpdocs/templates/gk_publisher/lib/menu/GKHandheld.php on line 76
Call Stack
#TimeMemoryFunctionLocation
10.0022413952{main}( ).../index.php:0
20.16894264512Joomla\CMS\Application\SiteApplication->execute( ).../index.php:49
30.792615926376Joomla\CMS\Application\SiteApplication->render( ).../CMSApplication.php:202
40.792915926432Joomla\CMS\Application\SiteApplication->render( ).../SiteApplication.php:778
50.792915926808Joomla\CMS\Document\HtmlDocument->parse( ).../CMSApplication.php:1030
60.792915926808Joomla\CMS\Document\HtmlDocument->_fetchTemplate( ).../HtmlDocument.php:545
70.793115926904Joomla\CMS\Document\HtmlDocument->_loadTemplate( ).../HtmlDocument.php:730
80.798015965144require( '/var/www/vhosts/shan.info/httpdocs/templates/gk_publisher/component.php' ).../HtmlDocument.php:668
90.812216257088GKTemplate->__construct( ).../component.php:31
100.828816578184GKTemplateMenu->getMenuType( ).../gk.framework.php:85
How To scp, ssh and rsync without prompting for password
Logo
Print this page

How To scp, ssh and rsync without prompting for password

Whenever you need to use scp to copy files, it asks for passwords. Same with rsync as it (by default) uses ssh as well. Usually scp and rsync commands are used to transfer or backup files between known hosts or by the same user on both the hosts. It can get really annoying the password is asked every time. I even had the idea of writing an expect script to provide the password. Of course, I didn't. Instead I browsed for a solution and found it after quite some time. There are already a couple of links out there which talk about it. I am adding to it...

Lets say you want to copy between two hosts host_src and host_desthost_src is the host where you would run the scp, ssh or rsyn command, irrespective of the direction of the file copy!

    1. host_src, run this command as the user thatscp/ssh/rsync

    $ ssh-keygen -t rsa

    This will prompt for a passphrase. Just press the enter key. It'll then generate an identification (private key) and a public key. Do not ever share the private key with anyone! ssh-keygen shows where it saved the public key. This is by default~/.ssh/id_rsa.pub:

    Your public key has been saved in <your_home_dir>/.ssh/id_rsa.pub

  1. Transfer the id_rsa.pub file to host_dest by either ftpscp, rsync or any other method.

    1. host_dest, login as the remote user which you plan to use when youscp,ssh rsync host_src.
  1. Copy the contents of id_rsa.pub to ~/.ssh/authorized_keys2

$ cat id_rsa.pub >>~/.ssh/authorized_keys2
$ chmod 700 ~/.ssh/authorized_keys2

If this file does not exists, then the above command will create it. Make sure you remove permission for others to read this file. If its a public key, why prevent others from reading this file? Probably, the owner of the key has distributed it to a few trusted users and has not placed any additional security measures to check if its really a trusted user.

  1. Note that ssh by default does not allow root to log in. This has to be explicitly enabled on host_dest. This can be done by editing /etc/ssh/sshd_config and changing the option of PermitRootLoginfrom no to yes. Don't forget to restart sshd so that it reads the modified config file. Do this only if you want to use the root login.

Well, thats it. Now you can run scp, ssh and rsync on host_src connecting to host_dest and it won't prompt for the password. Note that this will still prompt for the password if you are running the commands on host_dest connecting to host_src. You can reverse the steps above (generate the public key on host_dest and copy it to host_src) and you have a two way setup ready!


( ! ) Warning: count(): Parameter must be an array or an object that implements Countable in /var/www/vhosts/shan.info/httpdocs/templates/gk_publisher/html/com_k2/templates/default/item.php on line 169
Call Stack
#TimeMemoryFunctionLocation
10.0022413952{main}( ).../index.php:0
20.16894264512Joomla\CMS\Application\SiteApplication->execute( ).../index.php:49
30.16894264512Joomla\CMS\Application\SiteApplication->doExecute( ).../CMSApplication.php:196
40.601111455656Joomla\CMS\Application\SiteApplication->dispatch( ).../SiteApplication.php:233
50.601711480032Joomla\CMS\Component\ComponentHelper::renderComponent( ).../SiteApplication.php:194
60.603611535360Joomla\CMS\Component\ComponentHelper::executeComponent( ).../ComponentHelper.php:377
70.604311562760require_once( '/var/www/vhosts/shan.info/httpdocs/components/com_k2/k2.php' ).../ComponentHelper.php:402
80.617711962392K2ControllerItem->execute( ).../k2.php:64
90.617811962392K2ControllerItem->display( ).../BaseController.php:710
100.636412613096K2ControllerItem->display( ).../item.php:78
110.636412613096K2ControllerItem->display( ).../controller.php:19
120.643512984136Joomla\CMS\Cache\Controller\ViewController->get( ).../BaseController.php:663
130.662013004504K2ViewItem->display( ).../ViewController.php:102
140.781415845112K2ViewItem->display( ).../view.html.php:742
150.781415845112K2ViewItem->loadTemplate( ).../HtmlView.php:230
160.785816018048include( '/var/www/vhosts/shan.info/httpdocs/templates/gk_publisher/html/com_k2/templates/default/item.php' ).../HtmlView.php:701

( ! ) Notice: Only variables should be assigned by reference in /var/www/vhosts/shan.info/httpdocs/templates/gk_publisher/html/com_k2/templates/default/item.php on line 478
Call Stack
#TimeMemoryFunctionLocation
10.0022413952{main}( ).../index.php:0
20.16894264512Joomla\CMS\Application\SiteApplication->execute( ).../index.php:49
30.16894264512Joomla\CMS\Application\SiteApplication->doExecute( ).../CMSApplication.php:196
40.601111455656Joomla\CMS\Application\SiteApplication->dispatch( ).../SiteApplication.php:233
50.601711480032Joomla\CMS\Component\ComponentHelper::renderComponent( ).../SiteApplication.php:194
60.603611535360Joomla\CMS\Component\ComponentHelper::executeComponent( ).../ComponentHelper.php:377
70.604311562760require_once( '/var/www/vhosts/shan.info/httpdocs/components/com_k2/k2.php' ).../ComponentHelper.php:402
80.617711962392K2ControllerItem->execute( ).../k2.php:64
90.617811962392K2ControllerItem->display( ).../BaseController.php:710
100.636412613096K2ControllerItem->display( ).../item.php:78
110.636412613096K2ControllerItem->display( ).../controller.php:19
120.643512984136Joomla\CMS\Cache\Controller\ViewController->get( ).../BaseController.php:663
130.662013004504K2ViewItem->display( ).../ViewController.php:102
140.781415845112K2ViewItem->display( ).../view.html.php:742
150.781415845112K2ViewItem->loadTemplate( ).../HtmlView.php:230
160.785816018048include( '/var/www/vhosts/shan.info/httpdocs/templates/gk_publisher/html/com_k2/templates/default/item.php' ).../HtmlView.php:701
Template Design © Joomla Templates | GavickPro. All rights reserved.