Find the answer to your Linux question:
Page 5 of 6 FirstFirst 1 2 3 4 5 6 LastLast
Results 41 to 50 of 52
[root@advtest mytest5]# chmod -x hash.py [root@advtest mytest5]# $ ./hash.py mytestpwd123 bash: $: command not found [root@advtest mytest5]#...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #41
    Just Joined!
    Join Date
    May 2014
    Location
    Maryland
    Posts
    24

    [root@advtest mytest5]# chmod -x hash.py
    [root@advtest mytest5]# $ ./hash.py mytestpwd123
    bash: $: command not found
    [root@advtest mytest5]#

  2. #42
    Linux Engineer
    Join Date
    Dec 2013
    Posts
    1,488
    Ah. The $ is not part of the command. The $ is part of bashes (the shell) prompt.
    Code:
    ./hash.py mytestpwd123
    is how you should run it.

  3. #43
    Linux Engineer
    Join Date
    Dec 2013
    Posts
    1,488
    As an off topic aside - do you have another user other then root? Unless you need to be root for some reason it is always better to use a less privileged user in Linux. A root user can accidently do damage that a regular user can't.

  4. $spacer_open
    $spacer_close
  5. #44
    Just Joined!
    Join Date
    May 2014
    Location
    Maryland
    Posts
    24
    still got an error:
    ----------------
    [root@advtest mytest5]# chmod +x hash.py
    [root@advtest mytest5]# ./hash.py mytestpwd123
    : No such file or directory
    [root@advtest mytest5]#

  6. #45
    Just Joined!
    Join Date
    May 2014
    Location
    Maryland
    Posts
    24
    I'm not so sure. I'm given the access by the network people to do this test in here. Later on when this executable is usable, this file will be placed in a folder under root and the webapp templates are all under the root. But is this a real root or a virtual root, I'm not sure.

  7. #46
    Linux Engineer
    Join Date
    Dec 2013
    Posts
    1,488
    The first line of the script likely needs to read
    Code:
    #!/usr/bin/env python2
    As per post #41 in this thread you can use the which command to determine if executables exist and where things are on your system.
    i.e.
    From the commandline:
    Code:
    which env
    which python
    which python2

  8. #47
    Just Joined!
    Join Date
    May 2014
    Location
    Maryland
    Posts
    24
    For some reason I did not see #41 posting and now it make more sense.
    So I changed the first line into python2 and removed which env from the last line
    My hash.py is now looks like this:
    -------------------------------
    #!/usr/bin/env python2
    import hashlib, uuid, sys
    salt = uuid.uuid4 ().hex
    hashed_password = hashlib.sha512 (sys.argv[1] + salt).hexdigest ()
    print (hashed_password)

    I also tried typing in: man env and I got "env - run a program in a modified environement" just like you said.

    When I re-ran it I still got the same result:
    ---------------------------------------
    [root@advtest mytest5]# ls -l
    total 4
    -rwxrwxrwx. 1 www webgroup 178 May 8 13:33 hash.py
    [root@advtest mytest5]# chmod +x hash.py
    [root@advtest mytest5]# ./hash.py mytestpwd123
    : No such file or directory

    So based on your explanation on thread #41, Let me go and ask the network engineer why either one of the two commands being executed can't be found.

  9. #48
    Just Joined!
    Join Date
    May 2014
    Location
    Maryland
    Posts
    24
    hi Gregm, Hope you don't mind me asking again. My Network people has not responded to me....
    How can I debug when I got:
    [root@advtest myfolder]# ./md5
    Segmentation fault (core dumped)

    It looks like it's compiled but I got the segmentation fault.
    How can I see what's going on when I get this message?

  10. #49
    Linux Engineer
    Join Date
    Dec 2013
    Posts
    1,488
    Presuming the system you ran the program on is configured to write core files you could load the core dump into gdb. Debugging a core dump isn't a trivial exercise but a web search will give you some hints. It indicates a problem with the code you compiled. There may have been some environmental assumptions made that don't hold.

  11. #50
    Just Joined!
    Join Date
    May 2014
    Location
    Maryland
    Posts
    24
    Oh ok thank you

Page 5 of 6 FirstFirst 1 2 3 4 5 6 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •