Find the answer to your Linux question:
Page 2 of 4 FirstFirst 1 2 3 4 LastLast
Results 11 to 20 of 33
I use to use /etc/init.d/rc.local file to define actions upon booting. You should edit that file and add commands you would like to be executed. If I add for example ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #11
    Linux Enthusiast minthaka's Avatar
    Join Date
    May 2006
    Location
    Mol, Vojvodina
    Posts
    556

    I use to use /etc/init.d/rc.local file to define actions upon booting.
    You should edit that file and add commands you would like to be executed. If I add for example line:
    cp -f /www /somewhere/backup
    It will copy the content of /www folder to /somewhere/backup overwriting the existing content, and thus it will create a backup of the the work done during the previous boot.
    If you need a CD/DVD catalogizer, give a try to my program:
    http://www.kde-apps.org/content/show...content=100682
    Linux Usert#430188

  2. #12
    Just Joined!
    Join Date
    May 2011
    Posts
    38
    So, the problem is not to execute a program in another folder... The problem is that I needed to use "sudo" to execute the program. I have created the same script inside of the folder where my executable program is. After booting, the command to execute the program is entered but one has to enter the password. I would like to have it automatically entered.
    Any ideas?
    Last edited by freddyglima; 05-03-2011 at 06:30 PM.

  3. #13
    Linux User sgosnell's Avatar
    Join Date
    Oct 2010
    Location
    Baja Oklahoma
    Posts
    438
    Edit your sudoers file.

  4. #14
    Just Joined!
    Join Date
    Mar 2007
    Location
    Melbourne, Australia
    Posts
    29
    Quote Originally Posted by freddyglima View Post
    So, the problem is not to execute a program in another folder... The problem is that I needed to use "sudo" to execute the program. I have created the same script inside of the folder where my executable program is. After booting, the command to execute the program is entered but one has to enter the password. I would like to have it automatically entered.
    Any ideas?
    man sudoers
    Code:
      requiretty      If set, sudo will only run when the user is logged in
                           to a real tty.  When this flag is set, sudo can only be
                           run from a login session and not via other means such
                           as cron(8) or cgi-bin scripts.  This flag is off by
                           default.
    Cheers,
    ak.

  5. #15
    Just Joined!
    Join Date
    May 2011
    Posts
    38
    I guess that I have done something not really smart.
    I removed by a mistake the "%" from sudoers:

    Code:
    # User privilege specification
    root    ALL=(ALL) ALL
    
    # Members of the admin group may gain root privileges
    %admin ALL=(ALL) ALL
    Now, I can't use my user.name as sudo and that way, I can't add the "%" back. I don't have an user root neither.

  6. #16
    Just Joined!
    Join Date
    Mar 2007
    Location
    Melbourne, Australia
    Posts
    29
    Quote Originally Posted by freddyglima View Post
    I guess that I have done something not really smart.
    I removed by a mistake the "%" from sudoers:

    Code:
    # User privilege specification
    root    ALL=(ALL) ALL
    
    # Members of the admin group may gain root privileges
    %admin ALL=(ALL) ALL
    Now, I can't use my user.name as sudo and that way, I can't add the "%" back. I don't have an user root neither.
    Boot to recovery console and you should be good. If you can't even get to the recovery console, then boot off of the install cd/dvd and chose the repair option. Follow the prompts and choose to have the partitions mounted. All you then need to do is to edit the /mnt/sysimage/etc/sudoers (if the recovered partitions are mounted at /mnt/sysimage - I've yet to visit the recovery console on ubuntu, so I'm hoping it is similar to CentOS/RedHat) file and undo your mistake.

    Then reboot and all should be back to normal.

    Ciao,
    ak.

  7. #17
    Just Joined!
    Join Date
    May 2011
    Posts
    38
    Thanks for your answer Ak!
    Actually, the solution was to plug my SD card with Linux in a laptop and change the file sudoers back to how it was. It works!
    However, I still do not know the changes which I should make in sudoers.

  8. #18
    Just Joined!
    Join Date
    Mar 2007
    Location
    Melbourne, Australia
    Posts
    29
    All you need to do is comment the following line from:
    Code:
    Defaults requiretty
    to

    Code:
    #Defaults requiretty
    Your script should now run without further ado.

    Cheers,
    ak.

  9. #19
    Just Joined!
    Join Date
    May 2011
    Posts
    38
    Hello Ak,
    apparently, there is no such a line command in my sudoers program. Mine looks like the following:

    Code:
     #/etc/sudoers
    #
    # This file MUST be edited with the 'visudo' command as root.
    #
    # See the man page for details on how to write a sudoers file.
    #
    
    Defaults        env_reset
    
    # Host alias specification
    
    # User alias specification
    
    # Cmnd alias specification
    
    # User privilege specification
    root    ALL=(ALL) ALL
    
    # Uncomment to allow members of group sudo to not need a password
    # (Note that later entries override this, so you might need to move
    # it further down)
    #%sudo ALL=NOPASSWD: ALL
    %admin ALL=(ALL) ALL
    I have uncommented:
    Code:
    #%sudo ALL=NOPASSWD: ALL
    And also added:
    Code:
    my.username   ALL=(ALL) ALL
    And it still did not work.

  10. #20
    Just Joined!
    Join Date
    Mar 2007
    Location
    Melbourne, Australia
    Posts
    29
    Quote Originally Posted by freddyglima View Post
    Hello Ak,
    apparently, there is no such a line command in my sudoers program.
    I've seen my error. Since you are required to enter your password, the script is most likely running but waiting for password entry. I wonder if the following command will show that your script is still in the running queue:
    Code:
    ps -ef|egrep [scriptname]
    Anyway, you'll need to change your sudo entry to:
    Code:
    my.username   ALL=(ALL) NOPASSWD: ALL
    This will ensure that you do not need type your password.

    The best way to ensure good security is to create an account with a very strong password (see www . grc . com/passwords.htm - apologies for url mangling as I'm not allowed to post when I'm still a baby on the forums; one needs to have >15 posts but I'm currently at 10), then use that account with the NOPASSWD entry in the /etc/sudoers file.

    Cheers,
    ak.

Page 2 of 4 FirstFirst 1 2 3 4 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
  •