Via the command script / Sudoers question

Hello MacGeniuses.

After trying to understand the solution for my part, I only managed to come up with a partial solution.

Main question:

I want to use an alias of office to shut down the computer. The reason is that I wish to first run another command without having to open a terminal every time.

And also, I don't want to enter a password every time.

Based on my homework, I created a text file, it gave an extension .command, did a chmod + x and then tried to use to run the following commands, both starting with a space to keep them out of the history of the orders:

Echo password | sudo nvram SystemAudioVolume = 80%

Echo password | sudo shutdown-h now

The commands work fine if I already have a sudo in terminal of this session. If I don't then I'm invited my password.

I even tried to add me in the sudoers file (in the last line) but that did not help:

Steve ALL = (ALL) NOPASSWD: / sbin/poweroff, /sbinreboot, / sbin/shutdown, / usr/sbin/nvram

When it comes to Linux type stuff, I am just a monkey-see, monkey-do person, so if you give me good advice, I can come back with a response like, "What is a power cord?" Please be as gentle as possible.

Secondary issue:

Everytime I open terminal I get a list of stuff like indicated below (there are several, I just cut and paste one of them). Anyone know how to stop this?

[Restored 22 July 2016, 20:54:32]

Last login: Friday, July 22, 20:53:18 on ttys000

Session restore: Fri Jul 22 20:53:56 EDT 2016

Steves - iMac:Desktop Steve$ chmod + x Shutdown.command

Steves-output iMac:Desktop Steve$

Logout

Saving session...

.. .saving story... truncate the history files...

... done.

[Process]

There is a way.  It is NOT the only way.

Google "ssh passwordles".

Set up your account without password ssh logins.

Now, take the ~/.ssh/id_*.pub file and put the contents of the file in the "/var/root/.ssh/authorized_keys of the root file (you will need to use sudo to perform this change)."

The id_*.pub file will probably be id_dsa.pub or id_rsa.pub, but it could be slightly different.

Now, you can

SSH root@localhost shutdown-h now

and you will not have a password.

NOTE: Make sure your id_ * (not the .pub file), which is your private key NEVER leaves your control and copies are not where someone else can get his hands on it.  If someone else gets your id_ file *, they can connect to your system with a password.

NOTE 2: There are ways to put a password your ssh keys and store them in your keychian.  Google: "ssh password in keychain".  It would be safer than no password, but you will still need to keep control of your keychain file.  It's always something

Tags: Mac OS & System Software

Similar Questions

  • How can I reset firefox via the command script (linux)

    I'm trying to set up a build server from Jenkins that uses SeleniumHQ and Firefox ESR during integration testing.

    I installed Firefox ESR 24 and seleniumHq 2.42.2

    I found that the State / the Firefox profile is getting damaged when selenium code stops.

    This prevents the FirefoxDriver selenium to establish a control connection because firefox is blocked on Firefox "the last time I fell - what do you do? Start over or try to recover?' screen.

    I want to do is make sure that I always start with a configuration of default Firefox of pure plant at the beginning of each race.

    for example, a configuration "Reset to factory defaults".

    This should be OK because the Jenkins account is used only for this build process.

    Unfortunately, there is no documentation on how / what to do jump far to achieve this.

    What should I do to achieve this? I see that there is a directory ~/.cache/mozilla, but appears not to be the magical place I'm looking for...

    The main profile folder is here:

    • Windows: C:\Users\ < user > < profile > \AppData\Roaming\Mozilla\Firefox\Profiles\.
    • Linux: ~/.mozilla/firefox/ < profile >.

    You will need to remove this folder where files get corrupted when you close Firefox.
    The other location is for the cache and other files as topic: newtab miniatures and phishing protection database.

  • Access iCloud drive via the command line

    I wanted to write a small script to access iCloud by car via the command line, and to my surprise, this seems to be a very special place that is not displayed in /Volumes or even in my home directory is Dropbox.

    Veterinarians here know the way, if not to enlightenment, then to iCloud drive?

    Thanks in advance.

    It is actually a rather interesting problem. I did research I should have done before I came here and found that iCloud Drive is accessible here:

    ~/Library/Mobile\ Documents

    What is interesting is that the many, many interesting things found in this directory when you reveal all the files through ls - al, is that custom directories seem to appear. Even more interesting, in the Finder, select go > go to folder... and that type path and it does not recognize the path. Type ~/Library/, and then of course that's fine and see you the directory of Documents Mobile...

  • How to enable and disable, copy or rename the rules via the groovy script?

    A client, we received this question:

    How to enable and disable, copy or rename the rules via the groovy script?

    Foglight 5.7.5

    Hello

    There is this example of support KB

    support.Software.Dell.com/.../99059

    and there is also documentation of Service layer of the administration on the RuleService console.

    Best regards

    Golan

  • Delete the registry via the command prompt keys

    I uninstalled a program on my computer, and I want to remove all the remaining files, registry keys and values of that particular program to the registry via the command prompt. Y at - it a command line that can scan and remove all the remaining files, registry keys and values of this particular program of the whole registry via the command prompt in only once.

    Please help me.

    If the uninstall program is correctly written, then it will do it all. If this isn't the case, you will have to do it manually. Although it is possible to write a script that will scan the registry for some channels, it is not a trivial task. Running one such script would be quite risky because it could easily delete the wrong registry key.

    Also note that the unused files or registry keys not used do not slow down a machine, contrary to popular belief. Purge of these undesirable things might give you a welcome warm feeling inside, but he has no effect on the performance of the PC.

  • How can I change text size and point via the command prompt?

    I want to create a script that will allow me to easily change to or from my TV to my monitor. I know how to change the display, but I don't know how I can change the size of text and point via the command prompt (that is, from 100% to 150%). Does anyone know how?

    Unfortunately, you can not.  In addition, change the DPI requires reboot (or logout and back).  But you can apply a different theme, that you can call from the command just by opening the .themepack file.  Since themes can control the size of some elements of the police who might do the trick you are looking for.

  • Does not open the files shared via the command run

    We use a server in our Organization and we can connect to this server using RDP. But when we try to access shared files and folders in this server via the command run in the client by entering the IP address of the server asks it enter network password, and we enter the right username and password (I'm sure that I entered the password and user name correct to 100%) it displays 'failed to connect '. ': unknown username or bad password ". and if we took the same user name and password via RDP it will easily connect without any error. Please give us the solution for this problem.

    Kind regards

    Vijay Kumar C.M.

    Left thread (files, folders, and online storage) for (web and networks).

    Hello

    Your question of Windows is more complex than what is generally answered in the Microsoft Answers forums. Appropriate in the TechNet forums.

    Please post your question in the TechNet forums: http://technet.microsoft.com/en-us/windowsserver/bb250589.aspx

    Thank you.

  • [Solved] Possible to enroll the workstation via the command line (Linux)?

    Hi all:

    Under Linux Mint or Ubuntu, the ToolTip that should allow me to save the product key just won't display, making me unable to use the program. Normally, the system should ask me a root password after I click to enter, but nothing happens here, and I can't find a problem in any log file (by clicking on the option adds nothing in the newspaper at all). I try this on a new brand operating system installation and using the installer to update from the Web site.

    Is it possible that I could fix this, or as asking the question, save the product via the command line key instead?

    Thank you!

    Is it possible that I could fix this, or as asking the question, save the product via the command line key instead?

    In a Terminal, use the following command and use your real serial number instead of the fake one which is indicated.

    / usr/lib/VMware/bin/vmware-vmx-new-sn 1A2B3-C4D5E-6F7G8-H9I0J-1K2L3M

  • External authentication via the PHP script failed

    I'm not a PHP genius - in fact I'm not a backend coder so I'm kinda struggeling with the sample scripts - I still hope for a sample of CF....

    I'm trying to run and connect to the CAA via the command line (Terminal). I'm not sure what I'm doing wrong - this is what I'm passing:
    PHP f /Applications/MAMP/htdocs/afcs.php args - debug - host = my_pass, http://connectnow.acrobat.com, fcguru, my_login

    The username and password I spend are correct. However, I get this response:
    Error: message exception 'AFCSError' with ' < State response 'error' = >
    < error code = "AUTH_FAILED" >
    < msg > failed authorization < / msg >
    < / error >
    < / answer >
    ' in /Applications/MAMP/htdocs/afcs.php:86

    Really struggeling with this. Once again I get this working from the command line, I don't know how to call it from a script instead. I use CF on the backend, no PHP.

    Kind regards

    Stefan

    Thank you, this is very useful. It seems that I can now connect from the Terminal so that's a good start. Also, I did not see external authentication in PHP for example - I must have been blind.
    I'll see how far I get with that. What I'm trying to do is spawn new rooms based on a template on the fly, and I have some doubts, I'll be able to understand this myself.

  • Hello, how is it possible to create the FAT32 BOOTCAMP on CoreStorage partition via the command line interface?

    Hello, how is it possible to create the FAT32 BOOTCAMP on CoreStorage partition via the command line interface?

    I mean ' diskutil cs * " and so on..."

    Yes, you must use the resizeStack command. Please see Re: how to repair fsck "your drive could not be partitioned..." Bootcamp does not as an example.

  • Satellite L - can I add new accounts via the command prompt?

    Is it possible that I can add new accounts to the machine via the command prompt on the screen of "recovery"?

    (When you start in recovery mode and select command prompt)

    I tried the normal commands "net user username / add ', but the accounts are not added to the machine.

    Y at - it another command which can be used?
    Thank you.

    Hello

    I don't know if it will work using the in my opinion Mr. recovery console, it is not possible.
    As far as I know that you can add the user and the password using the CMD, but this might work only when the Windows operating system has been loaded.

    In this case, you can use this command to add the user account: + net user username / add +.
    If you want to add a password for the user account, then you must use this way: + net user username password / Add +.

  • Is it possible to run the command script with user account administrator rights?

    Is it possible to run the command script with administrator user account rights means please tell me how to...

    I need to run it in windows 7 professional service pack 1.

    There are a few myths that won't go away, for example

    • You can perform administrative tasks when you are working from a command prompt.
    • A script (batch file, VBScript, PowerShell) gives you administrative rights.

    There is no substance to a myth. Your account has administrator privileges, or it does not. There is no backdoor.

  • deploy a virtual machine for the model stored in EXSI server via the command line

    Hello

    Is it possible to deploy a vm from a template stored in exsi server via the command line?

    The structure is shown in the attached picture. I want to deploy the model under "Templates" folder to a virtual machine "VM" sub-folder by command line of any machine.

    structure.jpg

    Hello

    PowerCLI can help you achieve this goal. Using PowerCLI, you can deploy remote host model.

    Here is an example for the same.

    http://www.harryjohn.org/deploy-multiple-VMs-from-template/

  • generate the fmx via the command prompt

    Hello

    I use Oracle forms6i, Oracle Database 10 g and Windows (OS).
    Is it possible to compile the FMB file via the command prompt.
    And then I need to move the files to the server fmx via the command prompt.


    Thank you
    Eliane.

    Published by: Sophie on January 24, 2012 17:20

    Eliane says:
    Hello

    I have created the batch file as directed by your code and I changed only the useridn/password@db.
    I have run the package
    But I can't find the fmx file.

    Sorry I post the compiler in batches of 10g

    Go where u run the batch file? It should be in this folder where you .fmb exist.
    So then do not work. Add the path before the ifcmp60.exe
    This is the compiler 6i

    Echo compiling forms ....
    for %%f IN (*.fmb) do C:\ORANT\BIN\ifcmp60.exe userid=mail/tti@ait module=%%f batch=yes module_type=form compile_all=yes window_state=minimize
    ECHO form compilation complete
    

    change the path of the ifcmp60.exe you have
    Hope it works for you

    If someone useful or appropriate, please mark accordingly.

    Published by: HamidHelal on January 24, 2012 20:12

  • BASH command via the console script

    All,

    I had to run a a series of BASH commands via the Script Console to a subset of servers. Is there a script for this that I can take a look? Or direct me to the controls, I might need.

    You need to encapsulate in a script on the remote host to do.

    actSvc = server["ActionService"]params = [:]params.put("COMMAND_LINE","/home/foglight/testBashScript.sh")params.put("HostName","centosvm1")actSvc.invoke("RemoteCommandAction",params)
    

    This will run the script shell on the host remote centosvm1

    the bash script contains the statement echo inside.

    -rwxr-xr-x 1 foglight dba 99 Jan 17, 12:09 testBashScript.sh

    [foglight@centosvm1 ~] $ testBashScript.sh more

    #! / bin/bash

    echo 'Test Action of Bash Script remote command execution' > /tmp/ForumOutput.txt

    [foglight@centosvm1 ~] $

    -rw - r - 1 foglight dba 56 Jan 17, 12:12 ForumOutput.txt

    [foglight@centosvm1 ~] $ /tmp/ForumOutput.txt more

    Run the test of the Action of the remote Script Bash command

    [foglight@centosvm1 ~] $

    I have tried a few iterations to try to echo the commands directly in a command param file but did not

    Hope this helps

Maybe you are looking for

  • How is it possible to reset the game Burble Place from beginner, intermediate or advanced?

    Hello My son likes to play instead of Burble games and has fairly well mastered the beginner... There are other levels (intermediate and advanced).  I tried to reset the level, but when he enters one of the Burble games after resetting the scores, it

  • Equium P300-16 t - unable to connect the servers Saga online

    Hi, I hope someone here can help me. I'm playing Ether Saga Online on my laptop Toshiba (SATELLITE P300 16 t) and it installs fine but it won't let me connect to their servers. I have messaged their technical support staff first, I sent them all kind

  • OfficeJet Pro 8625: Remove printer OfficeJet

    I need to remove a printer HP OfficeJet Pro 8625 (8620) laptop.  The printer is a shared Ethernet network device.  I guess I have to remove both the printer itself (via Control Panel) as well as the associated software (drivers HP).  What is the corr

  • Can I import contacts from the microSD card

    Hi, I have a Lenovo S650 (with VIBE UI 2.0) and I want to import contacts from a card pulled from a BlackBerry Bold 9900. Contacts are saved in the Microsoft Outlook vCard (.vcf) format. So I was wondering how to import the .vcf files in my phone. se

  • Help on payroll

    Hi I have an urgent need,I have a lot of items pr prayer that we have in our project.Directly, the user enters the values in the amount input value. When the calculation proportional happenes after the payroll run here value in value to PAY but when