我尝试将文件夹从本地计算机上传到AWS EC2实例。我已经多次这样做但我目前遇到SCP问题。我已经测试了SSH和SCP的文件,他们正在工作。
我错过了什么?我已经更改了我发送的文件夹和EC2上接收端的文件夹的权限(使用:sudo chmod -R 777 dir
)。
我正在使用Linux。我一直使用的命令如下:
sudo scp -i -r /file_path/key.pem /file_path/dir_to_upload ec2-user@ec2_public_domain:/file_path/folder_to_receive_dir
我得到的错误如下:
Warning: Identity file -r not accessible: No such file or directory.
Permission denied (publickey).
lost connection
我没有想法。有什么建议吗?
答案 0 :(得分:3)
因为这可能会帮助我和我在这个问题上花费太长时间。
此命令的-r和-i的顺序。
scp -r -i /path/key.pem /path/dir_to_upload ec2-user@ec2_public_domain:/path/folder_to_receive_dir
不起作用
正确的命令是:
-v
另外,要查看可能导致错误的原因,请添加scp -v -r -i /path/key.pem /path/dir_to_upload ec2-user@ec2_public_domain:/path/folder_to_receive_dir
,如下所示:
add_action('woocommerce_cancelled_order','change_status_to_refund', 10, 1);
function change_status_to_refund( $order_id ) {
wp_redirect( home_url() );
$order = new WC_Order( $order_id );
if( 'refunded' == $order->get_status() ) {
return false;
}
if(!($order->is_paid())) {
return false;
}
$noRefundLimit = 24 * 60; //in minutes until booking
$customer_orders = get_posts( array(
'numberposts' => 1,
'post_parent' => $order_id,
'post_type' => 'wc_booking', // WC orders post type
'post_status' => 'paid, complete' // Only paid, completed bookings
) );
$bookingId = current($customer_orders)->ID;
$bookingStart = current(get_post_meta($bookingId, "_booking_start"));
$time = (new DateTime($bookingStart, new
DateTimeZone("America/Los_Angeles")))->getTimestamp();
$nowTime = (new DateTime())->getTimestamp();
$difference = round(($time - $nowTime)/60);//in minutes
if($difference >= $noRefundLimit) {
$refundPercentage = 1; //how much will we give back? fraction of 1.
// Get Items
$order_items = $order->get_items();
// Refund Amount
$refund_amount = 0;
// Prepare line items which we are refunding
$line_items = array();
if ( $order_items ) {
foreach( $order_items as $item_id => $item ) {
$refund_amount += $item->get_total();
}
}
$refund_amount = ($refund_amount * $refundPercentage);
$refund_reason = "Order Cancelled";
$refund = wc_create_refund( array(
'amount' => $refund_amount,
'reason' => $refund_reason,
'order_id' => $order_id,
'line_items' => $line_items,
'refund_payment' => true
));
var_dump($refund);
$order->update_status('wc-refunded', 'Order Cancelled And Completely
Refunded');
$order->save();
}