LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   bash/bin file wont executable, possible not the correct rights setup. (https://www.linuxquestions.org/questions/linux-newbie-8/bash-bin-file-wont-executable-possible-not-the-correct-rights-setup-683361/)

Dutch2005NL 11-14-2008 07:56 AM

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?

pixellany 11-14-2008 08:03 AM

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.

i92guboj 11-14-2008 08:25 AM

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/"

Dutch2005NL 11-14-2008 08:39 AM

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 :) )

i92guboj 11-14-2008 08:43 AM

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.

mrclisdue 11-14-2008 08:51 AM

Quote:

Originally Posted by Dutch2005NL (Post 3341810)
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,

Dutch2005NL 11-14-2008 09:37 AM

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

pixellany 11-14-2008 10:15 AM

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.

Dutch2005NL 11-17-2008 01:50 AM

Quote:

Originally Posted by pixellany (Post 3341894)
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...


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