Re: Script Test [OT]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 06Sep2008 12:01, kwhiskerz <kwhiskerz@xxxxxxxxx> wrote:
| A suggestion I found on the net is to test for the value of md5sum 
| /etc/passwd.

That's horrible. Unreliable, etc.

| Now, does this stay the same, even if a password is added or 
| changed?

With shadow passwords, yes. But if someone: changes their name, changes
their shell, changes their homedir, a new user is added, a user is
deleted. All these will break the test.

| Is it unique to a computer?

And it is not unique.
It is a very bad suggestion.
Just check hostname (and maybe domainname, depending how widely
your test needs to wordk).

| And also, how do I isolate the number and 
| strip off the space and "/etc/passwd" from the result?

With cut or sed or awk or perl or ...
But since it is a "signature", who cares if the filename is there or
not? Just compare the full thing.

Seriously, don't do the md5sum thing.

Personally, I try to set up three environment variables: $HOSTNAME,
being the full hostname (foo.example.com), $HOST, being the shortname
(foo) and $SYSTEMID being what I call the "administrative zone" ("home"
at home, "cisra" at a former workplace of that name, etc).  These are
all arbitrary and of course need special setup everywhere, but once they
are there it is possible to make sensible comparison statements. Then
the problem moves from an ad hoc test in a script to maintaining these
variables, which at least is a better defined problem.

So my scripts which care tend to say:

  case "$HOST@$SYSTEMID" in
    fleet@home)
      # my laptop ...
      ...
      ;;
  esac

and so forth.

Cheers,
-- 
Cameron Simpson <cs@xxxxxxxxxx> DoD#743
http://www.cskk.ezoshosting.com/cs/

I am returning this otherwise good typing paper to you because someone has
printed gibberish all over it and put your name at the top.
        - English Professor, Ohio University

-- 
fedora-list mailing list
fedora-list@xxxxxxxxxx
To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list
Guidelines: http://fedoraproject.org/wiki/Communicate/MailingListGuidelines
[Index of Archives]     [Older Fedora Users]     [Fedora Announce]     [Fedora Package Announce]     [EPEL Announce]     [Fedora Magazine]     [Fedora News]     [Fedora Summer Coding]     [Fedora Laptop]     [Fedora Cloud]     [Fedora Advisory Board]     [Fedora Education]     [Fedora Security]     [Fedora Scitech]     [Fedora Robotics]     [Fedora Maintainers]     [Fedora Infrastructure]     [Fedora Websites]     [Anaconda Devel]     [Fedora Devel Java]     [Fedora Legacy]     [Fedora Desktop]     [Fedora Fonts]     [ATA RAID]     [Fedora Marketing]     [Fedora Management Tools]     [Fedora Mentors]     [SSH]     [Fedora Package Review]     [Fedora R Devel]     [Fedora PHP Devel]     [Kickstart]     [Fedora Music]     [Fedora Packaging]     [Centos]     [Fedora SELinux]     [Fedora Legal]     [Fedora Kernel]     [Fedora OCaml]     [Coolkey]     [Virtualization Tools]     [ET Management Tools]     [Yum Users]     [Tux]     [Yosemite News]     [Gnome Users]     [KDE Users]     [Fedora Art]     [Fedora Docs]     [Asterisk PBX]     [Fedora Sparc]     [Fedora Universal Network Connector]     [Libvirt Users]     [Fedora ARM]

  Powered by Linux