LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 12-14-2010, 12:18 PM   #1
hiteurecomupf
LQ Newbie
 
Registered: Oct 2010
Location: Barcelona
Distribution: Linux Ubuntu 9.10
Posts: 13

Rep: Reputation: 0
scp error : permission denied :((


Hi All ,

I am facing this scp permission denied again and again and am kind of lost of how to solve this. Before to discuss my error i need to write a bit on what context i am facing this error.

I am trying to make one traffic generator IMS Bench SIPp work , which will generate huge amount of traffic. Now in this traffic generator, it will use 2 virtual IP's who will be working as 2 Test Systems (TS1 and TS2). I have one host IP (A) where i have 2 virtual IP's (B,C) alive and running. I can ssh into both of them from host A with command " ssh B -l <username>". IP B is TS1 and IP C is TS2.

Now to prepare this 2 (B,C) Test System's , i need to run one script which is " ./prepare.sh". This script looks like this ,

echo "Preparing TS1 (IP B) ..."
ssh <IP B> "mkdir -p /usr/local/sipp"
scp ims_users_1.inf run_1.sh ../sipp <IP B>:/usr/local/sipp
if [ $? -ne 0 ]; then echo "Error: Failed to prepare TS1"; exit; fi
echo "Preparing TS2 (IP C) ..."
ssh <IP C> "mkdir -p /usr/local/sipp"
scp ims_users_2.inf run_2.sh ../sipp <IP C>:/usr/local/sipp
if [ $? -ne 0 ]; then echo "Error: Failed to prepare TS2"; exit; fi
echo "

When i am running this script i am getting this following error ,

sougata@sougata-desktop:~/ims_bench/ims_bench_0$ ./prepare.sh
Preparing TS1 (ip B) ...
scp: /usr/local/sipp/ims_users_1.inf: Permission denied
scp: /usr/local/sipp/run_1.sh: Permission denied
scp: /usr/local/sipp/sipp: Permission denied
Error: Failed to prepare TS1

Any suggestion please on why this scp error is coming.
I tried doing chmod 777 -R on this folder "ims_bench_0" where all the corresponding files are present such as ims_users_1.inf , run_1.sh etc. But no way can't let this error go away.

With regards ,

Sougata
 
Old 12-14-2010, 02:16 PM   #2
coexistance
Member
 
Registered: Dec 2010
Location: Earth planet
Distribution: Debian GNU/Linux 6 (Squeeze) - AMD64
Posts: 50

Rep: Reputation: 9
Hello hiteurecomupf

First of all, make sure that all the files are allowed to executable:
Code:
chmod +x ~/ims_bench/*
Now try execute as you have done.
If still doesn't work, try this:
Code:
sudo ~/ims_bench/ims_bench_0$ ./prepare.sh
Note: Will ask for the root password, type it

Good luck with the scripts.
 
Old 12-14-2010, 02:18 PM   #3
ShadowCat8
Member
 
Registered: Nov 2004
Location: Arcadia, CA
Distribution: Gentoo, Arch, (RedHat4.x-9.x, FedoraCore 1.x-4.x, Debian Potato-Sarge, LFS 6.0, etc.)
Posts: 220

Rep: Reputation: 46
Greetings,

Can you give us the output of "ls -l /usr/local/" and then the output of "ls -l /usr/local/sipp/", if it exists, from one of the virtual systems?

Also, I am assuming that you are running these as root (on all boxes), correct? If not, then that could be the issue right there.

From my current system:
Code:
 ~ # ls -al /usr/local/
drwxr-xr-x 10 root    root    4096 Feb 26  2009 .
drwxr-xr-x 17 root    root    4096 Nov  2 13:57 ..
drwxr-xr-x 2 root    root    4096 Jun 17  2008 bin
drwxr-xr-x 2 root    root    4096 Jun 17  2008 games
lrwxrwxrwx 1 root    root       5 Jan 16  2009 lib -> lib64
drwxr-xr-x 2 root    root    4096 Jun 17  2008 lib32
drwxr-xr-x 2 root    root    4096 Jun 17  2008 lib64
lrwxrwxrwx 1 root    root       9 Jan 16  2009 man -> share/man
drwxr-xr-x 6 portage portage 4096 Dec 14  2009 portage
drwxr-xr-x 2 root    root    4096 Jun 17  2008 sbin
drwxr-xr-x 4 root    root    4096 Jun 17  2008 share
drwxr-xr-x 2 root    root    4096 Jun 17  2008 src
Only root can make a directory there, so if you are not running as root, you probably aren't making that directory on /usr/local/.

HTH. Let us know.
 
Old 12-15-2010, 06:21 AM   #4
hiteurecomupf
LQ Newbie
 
Registered: Oct 2010
Location: Barcelona
Distribution: Linux Ubuntu 9.10
Posts: 13

Original Poster
Rep: Reputation: 0
Hello all,

As i said , i can ssh into both the virtual IP's (B&C) from the host A but only as a user not as a root. For example , i can do like this ,

sougata@sougata-desktop:~ ssh <ip B> -l sougata and it gets logged instantly but the moment i try to do like below -

sougata@sougata-desktop:~ ssh <ip B> -l root , it ask's for a password.
root@ip B:<> , and no matter how many times i give the root password for the machine A, as both the IP's B and C are virtual IP's on this host A , it doesn't take it. And after 3 times it get's out like this way below -

sougata@sougata-desktop:~ ssh <ip B> -l root
root@ip B's password:
Permission Denied
root@ip B's password:
Permission denied (publickey,password)

I can't even run the ./prepare.sh script as root as everytime i get this password asking.
So when i am running from user sougata like below , i am getting permission denied error like below ,

sougata@sougata-desktop:~/ims_bench/ims_bench_0$ ./prepare.sh
Preparing TS1 (ip B) ...
scp: /usr/local/sipp/ims_users_1.inf: Permission denied
scp: /usr/local/sipp/run_1.sh: Permission denied
scp: /usr/local/sipp/sipp: Permission denied
Error: Failed to prepare TS1

And when i am trying to run from root ,
root@sougata-desktop:~/ims_bench/ims_bench_0$ ./prepare.sh
Preparing TS1 (ip B) ...
root@ip B's password:
And that permission deny error and am getting out after 3 times.

Now what i am understanding from this error analysis(CORRECT ME IF I AM WRONG) is that, only if i can ssh to both the virtual IP's B and C from host A as ROOT , only in that scenario i can run the .prepare.sh script along with necessary permissions.

Now how to do this as i can only ssh as user but not as root. Trying so many times but failing everytime (.

Btw , when i do ls -l , i see -

sougata@sougata-desktop:~/ims_bench$ ls -l
total 3776
-rw-r--r-- 1 root root 24430 2010-10-11 17:43 actions.cpp
-rw-r--r-- 1 root root 8743 2010-10-11 17:43 actions.hpp
-rw-r--r-- 1 root root 78232 2010-11-12 18:59 actions.o
-rw-r--r-- 1 root root 4930 2010-10-11 17:43 asyncevent.cpp
-rw-r--r-- 1 root root 2222 2010-10-11 17:43 asyncevent.hpp
-rw-r--r-- 1 root root 9188 2010-11-12 18:59 asyncevent.o
-rw-r--r-- 1 root root 18220 2010-10-11 17:43 auth.cpp
-rw-r--r-- 1 root root 12408 2010-11-12 18:59 auth.o
-rw-r--r-- 1 root root 139550 2010-11-12 18:37 call.cpp
-rw-r--r-- 1 root root 139522 2010-10-11 17:43 call.cpp~
-rw-r--r-- 1 root root 14764 2010-10-11 17:43 call.hpp
-rw-r--r-- 1 root root 195176 2010-11-12 18:59 call.o
-rw-r--r-- 1 root root 1619 2010-10-11 17:43 comp.cpp
-rw-r--r-- 1 root root 1706 2010-10-11 17:43 comp.h
-rw-r--r-- 1 root root 1808 2010-11-12 18:59 comp.o
-rw-r--r-- 1 root root 151 2010-10-11 17:43 convunix.sh
-rw-r--r-- 1 root root 13237 2010-10-11 17:43 cpumem.cpp
-rw-r--r-- 1 root root 14255 2010-10-11 17:43 csocket.cpp
-rw-r--r-- 1 root root 3787 2010-10-11 17:43 csocket.hpp
-rw-r--r-- 1 root root 26092 2010-11-12 18:59 csocket.o
-rw-r--r-- 1 root root 3511 2010-11-12 18:47 except.cpp
-rw-r--r-- 1 root root 3511 2010-11-12 18:46 except.cpp~
-rw-r--r-- 1 root root 6273 2010-10-11 17:43 except.hpp
-rw-r--r-- 1 root root 15900 2010-11-12 18:59 except.o
drwxrwxrwx 2 root root 4096 2010-12-14 17:14 ims_bench_0
-rw-r--r-- 1 root root 16959 2010-10-11 17:43 LICENSE.txt
-rw-r--r-- 1 root root 149 2010-10-11 17:43 local.mk
-rw-r--r-- 1 root root 9177 2010-10-11 17:43 Makefile
-rwxr-xr-x 1 root root 133992 2010-11-12 19:00 mana

Regards to all ,

Sougata
 
Old 12-15-2010, 09:27 AM   #5
hiteurecomupf
LQ Newbie
 
Registered: Oct 2010
Location: Barcelona
Distribution: Linux Ubuntu 9.10
Posts: 13

Original Poster
Rep: Reputation: 0
Hi Shadowcat ,

I did ls -l /usr/local is showing me :

root@sougata-desktop:/home/sougata# ssh <ip B> -l sougata
sougata@<ip B's> password:
Linux sougata-desktop 2.6.31-22-generic #68-Ubuntu SMP Tue Oct 26 16:38:35 UTC 2010 i686

To access official Ubuntu documentation, please visit:
http://help.ubuntu.com/

Last login: Wed Dec 15 13:07:45 2010 from andreas-bmat.ca.upf.edu
sougata@sougata-desktop:~$
sougata@sougata-desktop:~$ ls -l /usr/local
total 40
drwxr-xr-x 2 root root 4096 2010-11-10 16:13 bin
drwxr-xr-x 2 root root 4096 2009-04-20 15:59 etc
drwxr-xr-x 2 root root 4096 2009-04-20 15:59 games
drwxr-xr-x 3 root root 4096 2010-11-10 15:45 include
drwxr-xr-x 7 root root 4096 2010-11-10 15:45 lib
drwxr-xr-x 3 root root 4096 2010-11-10 15:56 libexec
lrwxrwxrwx 1 root root 9 2010-10-11 16:40 man -> share/man
drwxr-xr-x 2 root root 4096 2009-04-20 15:59 sbin
drwxr-xr-x 17 root root 4096 2010-11-10 15:56 share
drwxr-xr-x 2 root root 4096 2010-12-13 17:10 sipp
drwxr-xr-x 2 root root 4096 2009-04-20 15:59 src

Kindly notice here , that i ssh into ip B using my username sougata but not using ROOT.
It's not letting me in using root, asking me password which i don't know what to give.
Here the password is the machine password of host A. But when i am going to do using root no password working. Just to mention also in my sshd_config file already permitted of getting connected through root.

Regards,

Sougata
 
Old 12-15-2010, 11:52 AM   #6
hiteurecomupf
LQ Newbie
 
Registered: Oct 2010
Location: Barcelona
Distribution: Linux Ubuntu 9.10
Posts: 13

Original Poster
Rep: Reputation: 0
ahh finally solved... thanks to both of you for your helping inputs...
cheers ,
sougata
 
Old 12-15-2010, 08:09 PM   #7
coexistance
Member
 
Registered: Dec 2010
Location: Earth planet
Distribution: Debian GNU/Linux 6 (Squeeze) - AMD64
Posts: 50

Rep: Reputation: 9
Nice hiteurecomupf!
Can you please, post how you solved the problem if doesn't bother you, of course.

As that may will help in the case, I make a script dependent of other hosts.
If you can, thanks a ton, that would make me learn some stuff.
If not, well doesn't matter, what's important is that the problem is solved.

About the help, people are here for that, even if some members like me don't have master skills (far away from it, to be honest).
Cheers!

Last edited by coexistance; 12-15-2010 at 08:10 PM. Reason: typo
 
Old 12-16-2010, 05:47 AM   #8
hiteurecomupf
LQ Newbie
 
Registered: Oct 2010
Location: Barcelona
Distribution: Linux Ubuntu 9.10
Posts: 13

Original Poster
Rep: Reputation: 0
HI coexistence ,

Actually my error was coming due to some stupid mistake which i was constantly making due to not having one clear fundamental idea on giving "user password" and "superuser password".

As i said, i was able to login as user sougata but not as root. But to run the script ./prepare.sh , i need to login as root. Now i didn't realise that in Ubuntu user password and root password can be different. As i was thinking both the passwords should be same (don't know from where did i get that stupid idea... lol). And moreover this error has been bothering me for the past 1 week. So finally i figured out reading the Ubuntu documentation on logging in as "su" and "su -". I had completely forgotton the su - password , which i need to input to run this script as a root. And continuously i was giving the user password as i was thinking if i can change login with command "sudo su" giving this password(user one) then why it was not working in this case. But here it needs the proper su - password.. damn stupid me...

Sometimes this kind of errors are so time consuming to solve yet the solution is so simple. So i guess my biggest learning experience is to hold patience and to see more minutely..lol

Cheers ,

Sougata
 
Old 12-16-2010, 08:14 AM   #9
coexistance
Member
 
Registered: Dec 2010
Location: Earth planet
Distribution: Debian GNU/Linux 6 (Squeeze) - AMD64
Posts: 50

Rep: Reputation: 9
Thanks for replied hiteurecomupf
That happens, actually it did happen to me once too, When I switched from Debian for Ubuntu.
Your right, sometimes the simplest problems can be the greatest headaches.
But we learn with the mistakes so I think overall the time consumption is well invested.

cheers and good "bashing"!
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Permission Denied Error? your_shadow03 Linux - Newbie 5 12-10-2009 02:38 PM
[SOLVED] SSH - scp permission denied, doesnt make sense vendtagain Linux - Networking 8 10-13-2009 06:00 PM
permission denied error aahiqmir Linux From Scratch 1 03-30-2009 02:51 AM
SCP: permission denied wackolacko Linux - General 3 01-30-2009 02:16 PM
scp permission denied but have write access linuxfia Linux - Software 5 08-14-2008 12:33 PM


All times are GMT -5. The time now is 10:45 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration