Giter Club home page Giter Club logo

Comments (5)

clarkio avatar clarkio commented on August 22, 2024

Looked into the source code for hostname and came up with something that could work (based on this answer in SO:

sudo sh -c 'scutil --get ComputerName | awk '\''{print "ComputerName: ", $1}'\''
scutil --get HostName | awk '\''{print "HostName: ", $1}'\''
scutil --get LocalHostName | awk '\''{print "LocalHostName: ", $1}'\''
defaults read /Library/Preferences/SystemConfiguration/com.apple.smb.server NetBIOSName | awk '\''{print "NetBIOSName: " $1}'\'''

I imagine there might be a more elegant way of doing this, but I'm still learning bash 😃

Thoughts?

from m-cli.

rgcr avatar rgcr commented on August 22, 2024

Hello @clarkio , this is related to sudo and it can be configured in your sudo config file, you should add a line like this one

YOURUSER ALL=(ALL) NOPASSWD: ALL

And unfortunately most of commands requires permissions

from m-cli.

clarkio avatar clarkio commented on August 22, 2024

@rgcr thanks for the quick response.

Sorry for the potentially noob question, but can you elaborate more on what that will do? Does it essentially turn off any need for a password for my user account when root level commands are executed? If so, what if someone prefers a password to still be required for such commands due to security concerns?

from m-cli.

rgcr avatar rgcr commented on August 22, 2024

@clarkio, You can use PASSWD and NOPASSWD to specify whether the user has to enter a password or not.

And you are right, it will be annoying put the password multiple times, I have to improve that 👍

from m-cli.

rgcr avatar rgcr commented on August 22, 2024

As a quick workaround I've removed sudo in the commands that show the hostname

from m-cli.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.