Permission Denied When You Try to Copy Shared Files to a Local Drive to Ruby
source link: https://www.codesd.com/item/permission-denied-when-you-try-to-copy-shared-files-to-a-local-drive-to-ruby.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
Permission Denied When You Try to Copy Shared Files to a Local Drive to Ruby
Here is my very basic copy code:
require 'fileutils'
FileUtils.copy_file("\\\\winmomfs1\\3rdParty\\Oracle Client\\Oracle_11gR2\\win64_11gR2_client.zip","c:\\chef-tmp")
Here is the error I get:
C:\Users\ctote\Desktop>ruby cp.rb C:/opscode/chef/embedded/lib/ruby/1.9.1/fileutils.rb:1371:in `initialize': Permission denied - c:/chef-tmp (Errno::EACCES)
from C:/opscode/chef/embedded/lib/ruby/1.9.1/fileutils.rb:1371:in `open'
from C:/opscode/chef/embedded/lib/ruby/1.9.1/fileutils.rb:1371:in `block in copy_file'
from C:/opscode/chef/embedded/lib/ruby/1.9.1/fileutils.rb:1370:in `open'
from C:/opscode/chef/embedded/lib/ruby/1.9.1/fileutils.rb:1370:in `copy_file'
from C:/opscode/chef/embedded/lib/ruby/1.9.1/fileutils.rb:477:in `copy_file'
from cp.rb:2:in `<main>'
What am I doing wrong? I can manually copy these files through explorer, so I don't think it's a permissions thing.
I think you should use FileUtils::cp_r
and write code as below :
require 'fileutils'
FileUtils.cp_r("\\\\winmomfs1\\3rdParty\\Oracle Client\\Oracle_11gR2\\win64_11gR2_client.zip","c:\\chef-tmp")
Look this post - Ruby-FileUtils copy_file Permission denied on Windows
Recommend
-
6
Fixing the Docker Permission Denied While Trying to Connect to the Docker Daemon Socket Error Jun 10, 2020 I recentl...
-
14
GitHub 添加 ssh key 后仍然出现“Permission denied (publickey)”的解决办法 发表于...
-
8
runInstaller fails at CreateOUIProcess with permission denied
-
740
Description After logged into the web front end, PVE constantly asking me to login again. Since it’s impossible to stay login, I can’t upload big ISO image(like Windows), a window says Permission denied (invalid ti...
-
16
Openstack Error Qemu-img: Could not open '/var/lib/libvirt/images/' Permission DeniedHave you ever receive error message like below while working with Openstack and KVM?. If so, a fix is given here.Command: env LC_ALL=C LANG=C qemu...
-
12
unable to create file '/run/user/0/dconf/user': permission denied. dconf will not work properly....
-
11
Getting permission denied for SCP over SSH server to local Asked 8 years, 5 months ago ...
-
4
閱讀筆記: 「容器的除錯之路,遇到 Permission Denied 該怎麼辦」 Posted on 2022-05-04 Views: 8 「容器的除錯之路,遇到 Permission Denied 該怎麼辦」 標題: 「容器的除錯之路,...
-
6
Container permission denied: How to diagnose this error Learn what is causing a container permissions error and how to work aroun...
-
5
Encountered a ‘Permission Denied’ error on a file copied to a Docker image or when accessing a file on a mounted volume within a Docker container? In this blog, you will learn why you get a ‘Permission Denied’ error and how to solve it. Enjoy!...
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK