oracle用户无法scp,scp — oracle-tech

SCP and SFTP are part of SSH. What you are trying to accomplish is called SSH user equivalence.

In a nutshell, you need to add the RSA public key of your host to the authorized_key file on the remote host  you wish to connect to. Permissions are important. The authorized_key file should have 600, and the .ssh directory must be 700.

I created a very simple script for passwordless SSH logins some years ago, which has never let me down so far, at least not under Linux.

#!/bin/bash# Creating SSH public RSA key if non exist and copying it to remote target# for passwordless SSH login.# Author: Dude, Oracle OTN, 28-APR-2015# Arguments: $1 (ssh login to remote target)keyfile="$HOME/.ssh/id_rsa"[ -z "$1" ] && echo "[email protected]_host' argument required. Aborting." && exit 1 if [ ! -f $keyfile ]; then   mkdir -p $HOME/.ssh   ssh-keygen -t rsa -f $keyfile -N ''fipubkey=`cat $keyfile.pub`remote_ssh_dir="~/.ssh"remote_ssh_file="$remote_ssh_dir/authorized_keys"ssh -q $1 "mkdir -p $remote_ssh_dir; chmod 700 $remote_ssh_direcho "$pubkey" >> $remote_ssh_file; chmod 600 $remote_ssh_file"

For example:

dude$

Last login: Mon Aug  3 15:43:33 2020 from 10.0.0.34

If the above doesn't work, check .ssh and authorized_key file permission on your remote host and whether openssh is installed. Are you using Linux?

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值