LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
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 11-14-2008, 07:56 AM   #1
Dutch2005NL
LQ Newbie
 
Registered: Nov 2008
Location: The Netherlands
Distribution: Ubuntu
Posts: 7

Rep: Reputation: 0
Question bash/bin file wont executable, possible not the correct rights setup.


In previous post i had an issue with a bash file making..

I found a tutorial wich suggested me, to make a folder called "scripts" in the / folder (wich makes "scripts" located at /scripts

and so i did, using sudo mkdir scripts...

i also placed a script in it..

Code:
#!bin/bash

rdesktop -f -z sbc

wich should work...

i get the following message..

Quote:
bash: rdesktop.sh command not found
i also did

Code:
sudo chmod u+x rdesktop.sh
Code:
ls -l rdesktop.sh
gives:

Quote:
-rwxr--r-- 1 root root 32 2008-11-14 14:30 rdesktop.sh
i see it states root, the autologged on user is called "medewerker" so that needs to get changed as part 1

My question: how?

Question2: the tutorial i found stated something in the line of
Quote:
-rwxrw-r-- 1 willy willy 124 date file.sh
should be there... how to fix that?
 
Old 11-14-2008, 08:03 AM   #2
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Arch/XFCE
Posts: 17,802

Rep: Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738
I think you are looking for "chown"---this is used to change the owner and/or group for a file.

"man chown" for details.

The other issue I see is that you are putting an executable script into a new directory (/scripts). If you want to be able to run things here, then the directory needs to be added to your PATH variable. Otherwise, you would simply need to give the full path when calling the command.
 
Old 11-14-2008, 08:25 AM   #3
i92guboj
Gentoo support team
 
Registered: May 2008
Location: Lucena, Córdoba (Spain)
Distribution: Gentoo
Posts: 4,072

Rep: Reputation: 384Reputation: 384Reputation: 384Reputation: 384
A few things.

Are you going to run rdesktop as root? You shouldn't.

Run it as a regular user. Maybe you meant ~/scripts, and not /scripts. Your user scripts should reside in your $HOME directory, and not on any other place. There's no need to operate as root for this, and you should always operate with the minimal privileges that are necessary for a given task. Otherwise you are assuming an unnecessary risk.

Note that, in your case, you are chmoding the script with u+x, which means +x to user, and user is root. So, no one else will be able to run it anyway, and as said, you shouldn't run such kind of apps as root.

Another problem is your $PATH. /scripts is not a common location to search for executable files. So you need to add it to your path. To add a path globally you could use /etc/profile, or whatever mechanism your distro offers (that file might be changed without any notice the next time you upgrade bash). If you take my advice and decide to run it as a user, then you can add a path into ~/.bashrc and ~/.bash_profile (this all assumes that bash is your default shell).

Code:
PATH="${PATH}:${HOME}/scripts/"
 
Old 11-14-2008, 08:39 AM   #4
Dutch2005NL
LQ Newbie
 
Registered: Nov 2008
Location: The Netherlands
Distribution: Ubuntu
Posts: 7

Original Poster
Rep: Reputation: 0
ok, were can I place the scripts, to easy open it?

i can just insert,

Code:
sudo chown medewerker /scripts // this gives ownership to user "medewerker"
cd /scripts
sudo chown medewerker rdesktop.sh // this gives ownership to user "medewerker"
If i did a thing wrong... how should i give the user the rights/ownership..

*edit* it seems to work... now all i gotta find out is to get it to autostart, yet if i just insert the full path to the script (its going to be the only script, as its going to work in a loop aka ubuntu-thinclient )

Last edited by Dutch2005NL; 11-14-2008 at 08:44 AM.
 
Old 11-14-2008, 08:43 AM   #5
i92guboj
Gentoo support team
 
Registered: May 2008
Location: Lucena, Córdoba (Spain)
Distribution: Gentoo
Posts: 4,072

Rep: Reputation: 384Reputation: 384Reputation: 384Reputation: 384
I just told you: put it in your home instead, and add the paths into the said files. Then, close bash and open it again so the .bashrc is sourced.
 
Old 11-14-2008, 08:51 AM   #6
mrclisdue
Senior Member
 
Registered: Dec 2005
Distribution: Slackware -current, 14.2
Posts: 1,081

Rep: Reputation: 190Reputation: 190
Quote:
Originally Posted by Dutch2005NL View Post
ok, were can I place the scripts, to easy open it?

i can just insert,

Code:
sudo chown medewerker /scripts
cd /scripts
sudo chown medewerker rdesktop.sh
A couple of things, and I'm hoping not to confuse you, nor to override any advice given.

The *normal* directories for executables are /usr/bin & /usr/local/bin. A lot of Slackware users (and I suspect other distros' users, as well) would put their self-made executables in /usr/local/bin.

Generally, executables are put into some kind of *bin* directory...

/usr/bin & /usr/local/bin are normally already in $PATH by default, so you wouldn't have to make any changes to $PATH.

Also, you don't *necessarily* have to chmod u+x to make a script executable, unless you wish to restrict its execution to the file's owner, which can also be accomplished through file permissions. In other words, chmod +x should suffice.

hth,
 
Old 11-14-2008, 09:37 AM   #7
Dutch2005NL
LQ Newbie
 
Registered: Nov 2008
Location: The Netherlands
Distribution: Ubuntu
Posts: 7

Original Poster
Rep: Reputation: 0
Ok, well i did the chown in the folder, and the script works..

1 thing though...

i found out it starts... yet system became inresponcive? could that be of the constantlooping? the comp is only a 500Mhz celeron 128MB + XFCE desktop
 
Old 11-14-2008, 10:15 AM   #8
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Arch/XFCE
Posts: 17,802

Rep: Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738
OK---rdesktop is a utility to connect to a remote desktop--I don't know what the particular syntax is that you used. And what do you mean by "constantlooping"?

AND--what to you mean by "unresponsive"? What exactly is happening.
 
Old 11-17-2008, 01:50 AM   #9
Dutch2005NL
LQ Newbie
 
Registered: Nov 2008
Location: The Netherlands
Distribution: Ubuntu
Posts: 7

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by pixellany View Post
OK---rdesktop is a utility to connect to a remote desktop--I don't know what the particular syntax is that you used. And what do you mean by "constantlooping"?

AND--what to you mean by "unresponsive"? What exactly is happening.
Code:
while [ 1 ];rdesktop -f -z sbc;done
And for unresponcive: Mouse works, Keyboard numlock works. Unable to insert username and password at windows 2003 terminal server login-screen.

I just tried again now it just works like a charm

I do have 1 more "problem"

the pc I tested on has a BIOS, that is from 1999, and so i get the bios older then 2000 message and it states acpi=force, needs to be added, so i press esc when grub states me so, I add acpi=force at the end of the line press enter, and I see the
Quote:
acpi=force
at the end of the line (so far so good), then I say ok load this thing, and I still get the 1999 is to old for acpi message...

Last edited by Dutch2005NL; 11-17-2008 at 03:12 AM.
 
  


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
Howto convert bin file to a executable DOS file lilzz Linux - Newbie 5 08-04-2006 12:03 AM
How to make a bin file executable and install the prgram shariqali Linux - Software 6 03-29-2006 01:11 PM
/tools/bin/env: /tools/bin/bash: No such file or directory DaZjorz Linux From Scratch 21 07-27-2005 07:11 AM
Bin file wont install need VM?? firecreature Linux - Software 1 08-31-2004 11:15 PM
bin/bash:usr/bin/lpr NO SUCH FILE OR DIRECTORY Adibe_Hamm Linux - Newbie 3 10-14-2003 02:30 AM


All times are GMT -5. The time now is 09:32 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