0

I'm new to vmware and I'm tying to execute a script but can't seem to get it to work. I've changed the file permissions a whole bunch and I end up getting either Permission Denied or if I open it up a lot, not found

[admin@op:/tmp] chmod 755 /tmp/admin_tmp.sh 
[admin@op:/tmp] ls -ll
total 35100
-rwxr-xr-x    1 root     root          1213 Feb 15 19:03 admin_tmp.sh
drwxr-xr-x    1 root     root           512 Feb 15 19:03 nfsgssd_krb5cc
-rw-------    1 root     root            40 Feb 15 19:45 probe.session
-rwxrwxrwx    1 root     root             0 Feb 15 19:04 terraform_1695115693.sh
-rwxrwxrwx    1 root     root             0 Feb 15 19:24 terraform_2109053339.sh
drwx------    1 root     root           512 Feb 15 19:16 vmware-root
[admin@op:/tmp] /tmp/admin_tmp.sh 
-sh: /tmp/admin_tmp.sh: not found

I've tried permission at 644, 655, 777 and still no luck

tried to run this to get more details on the file: cat -vet /tmp/admin_tmp.sh|head -1 but got this:

cat: invalid option -- 'v' BusyBox v1.22.1 (2016-03-26 07:03:26 PDT) multi-call binary. Usage: cat [FILE]... Concatenate FILEs and print them to stdout.

tried to run catv and file as well but those packages aren't there saying not found

I've never worked with busyboxy before so i'm really confused on why this is happening....

lightweight
  • 113
  • 1
  • 6
  • Where did you get this script? What is `cat -vet` supposed to do? – Michael Hampton Feb 16 '19 at 00:07
  • the script is generated by terraform. I have a terraform file that provisions a server on packet.com and then to bootstrap it, I have this shell script that runs then. – lightweight Feb 16 '19 at 21:29
  • You ran a command (apparently) without understanding what it does. That's a very bad habit to get into; people have managed to lose years of important files that way. You didn't need to use `cat` at all, to inspect the shebang line, just `head`. This is called a _useless use of cat_ and there are thousands of webpages you can look at later that discuss it. ESXi uses busybox to provide a minimal set of basic Unix commands with a restricted set of options. Its `cat` has no options. Its `head` has minimal options. Put it all together: `head -n 1 /tmp/admin_tmp.sh` instead to inspect the shebang. – Michael Hampton Feb 16 '19 at 21:52
  • 1
    Then, ESXi hasn't got bash, but only a minimal shell `/bin/sh`. If your script doesn't call that in its shebang, you won't be able to run it directly. Edit the script if necessary before you try to run it. Finally, you'll probably run into other issues if there are other things missing (and there probably are; the ESXi shell provides a very minimalist environment). – Michael Hampton Feb 16 '19 at 21:53
  • thanks....never worked with busybox but what I ended up doing was using ansible modules instead of terraform executing bash commands. So now terraform kicks off a ansible module instead of executing a bash script...found it to be much easier and cleaner in the end... – lightweight Feb 19 '19 at 19:18

0 Answers0