disable ubuntu 10.10 screensaver using command - screensaver

Does anyone know how to disable ubuntu 10.10 screensaver by just using command or edit conf?
because I can only ssh to the machine to turn the screensaver off
thx.

To disable the screensaver:
gconftool-2 -s /apps/gnome-screensaver/idle_activation_enabled --type=bool false
To disable monitor sleeping:
gconftool-2 -s /apps/gnome-power-manager/timeout/sleep_display_ac --type=int 0

The command to disable monitor sleeping has changed. You should now run:
gconftool-2 -s /apps/gnome-power-manager/timeout/sleep_display_ac --type=int 0

Related

How to ignore reboot prompt in a ShellScript

I am trying to create a Shellscript with the following commands.
#!/bin/bash
ipa-client-install --uninstall
/usr/local/sbin/new-clone.sh -i aws -s aws-dev
My problem is that the ipa-client-install --uninstall command prompts for a reboot at the end with the default value being no.
Here is the output.
Client uninstall complete. The original nsswitch.conf configuration
has been restored. You may need to restart services or reboot the
machine. Do you want to reboot the machine? [no]:
How can I supress the reboot dialog and just accept the default "no"?
How can I check to see if ipa-client-install is installed before attempting to remove it?
I am new to Shellscripting, so I am struggling a bit :-)
Please be safe.
You can use Linux pipes to take care of the prompt issue. To rpm -q will help you to check if the package is available.
Your final script would be like
#!/bin/bash
if rpm -q ip-client-install
then
echo no | ipa-client-install --uninstall
else
echo "Package not found"
fi
/usr/local/sbin/new-clone.sh -i aws -s aws-dev

Can nmon use Data Capture Mode in Windows Subsystem for Linux?

I tried to capture using the below command in WSL Ubuntu.
moauris#AUR00101:~$ /pp/nmon/nmon -s 60 -c 1440 -f -m /mnt/c/Perf_data/
It was supposed to run as a process until 1440 captures, but it did not. It ran and immediately end.
Please guide me to the correct way to capture nmon, or it cannot be done in WSL? Thanks!

Where to find sshd logs on MacOS sierra

I want to install Pseudo-Distributed HBase environment on my Mac OS Sierra (10.12.4), and it requires ssh installed and can log with ssh localhost without password. But sometimes I came across with error when I use ssh to log in. Above all are question background, and the actual question is where can I find debug logs of sshd so I could know why logging is failed in further?
As I know, Mac OS already have sshd installed and use launchd to manage it, and I know one way to output debug logs by sshd -E /var/log/sshd.log, but when I reviewed /etc/ssh/sshd_config configuration and there are two lines:
#SyslogFacility AUTH
#LogLevel INFO
I guess these two lines are used to config debug mode, then I removed # before them and set LogLevel to DEBUG3 and then restarted sshd:
$ launchctl unload -w /System/Library/LaunchDaemons/ssh.plist
$ launchctl load -w /System/Library/LaunchDaemons/ssh.plist
And then I set log path in /etc/syslog.conf:
auth.*<tab>/var/log/sshd.log
<tab> means tab character here, and reloaded the config:
$ killall -HUP syslogd
But sshd.log file can not be found in /var/log folder when I executed ssh localhost. I also tried config the /etc/asl.log:
> /var/log/sshd.log format=raw
? [= Facility auth] file sshd.log
And the result was the same, can someone help me?
Apple, as usual, decided to re-invent the wheel.
In super-user window
# log config --mode "level:debug" --subsystem com.openssh.sshd
# log stream --level debug 2>&1 | tee /tmp/logs.out
In another window
$ ssh localhost
$ exit
Back in Super-user window
^C (interrupt)
# grep sshd /tmp/logs.out
2019-01-11 08:53:38.991639-0500 0x17faa85 Debug 0x0 37284 sshd: (libsystem_network.dylib) sa_dst_compare_internal <private>#0 < <private>#0
2019-01-11 08:53:38.992451-0500 0xb47b5b Debug 0x0 57066 socketfilterfw: (Security) [com.apple.securityd:unixio] open(/usr/sbin/sshd,0x0,0x1b6) = 12
...
...
In super-user window, restore default sshd logging
# log config --mode "level:default" --subsystem com.openssh.sshd
You can find it in /var/log/system.log. Better if you filter by "sshd":
cat /var/log/system.log | grep sshd
Try this
cp /System/Library/LaunchDaemons/ssh.plist /Library/LaunchDaemons/ssh.plist
Then
vi /Library/LaunchDaemons/ssh.plist
And add your -E as shown below
<array>
<string>/usr/sbin/sshd</string>
<string>-i</string>
<string>-E</string>
<string>/var/log/system.log</string>
</array>
And lastly restart sshd now you will see sshd logs in /var/log/system.log
launchctl unload /System/Library/LaunchDaemons/ssh.plist && launchctl load -w /Library/LaunchDaemons/ssh.plist
I also had an ssh issue that I wanted to debug further and was not able to figure out how to get the sshd debug logs to appear in any of the usual places. I resorted to editing the /System/Library/LaunchDaemons/ssh.plist file to add a -E <log file location> parameter (/tmp/sshd.log, for example). I also edited /etc/ssh/sshd_config to change the LogLevel. With these changes, I was able to view the more verbose logs in the specified log file.
I don't have much experience with MacOS so I'm sure there is a more correct way to configure this, but for lack of a better approach this got the logs I was looking for.
According to Apple's developer website, logging behavior has changed in macOS 10.12 and up:
Important:
Unified logging is available in iOS 10.0 and later, macOS 10.12 and later, tvOS 10.0 and later, and watchOS 3.0 and later, and supersedes ASL (Apple System Logger) and the Syslog APIs. Historically, log messages were written to specific locations on disk, such as /etc/system.log. The unified logging system stores messages in memory and in a data store, rather than writing to text-based log files.
Unfortunately, unless someone comes up with a pretty clever way to extract the log entries from memory or this mysterious "data store", I think we're SOL :/
There is some sshd log in
/var/log/system.log
for example
Apr 26 19:00:11 mac-de-mamie com.apple.xpc.launchd[1] (com.openssh.sshd.7AAF2A76-3475-4D2A-9EEC-B9624143F2C2[535]): Service exited with abnormal code: 1
Not very instructive. I doubt if more can be obtained. LogLevel VERBOSE and LogLevel DEBUG3 in sshd_config do not help.
According to man sshd_config :
"Logging with a DEBUG level violates the privacy of users and is not recommended."
By the way, I relaunched sshd not with launchctl but with System preference Sharing, ticking Remote login.
There, I noticed the option : Allow access for ...
I suspect this settings to be OUTSIDE /etc/ssh/sshd_config
(easy to check but I have no time).
Beware that Mac OS X is not Unix : Apple developpers can do many strange things behind the scene without any care for us command line users.

Integrated Windows Auth (NTLM) on a Mac using Google Chrome or Safari

An IIS7 Intranet site with Windows Authentication enabled. When hit from Chrome on windows the pass-through authentication works fine (no User / Password prompt), however, Chrome on a Mac you get a prompt. Since the internal network uses CAC/PKI no one has a password.
I've tried toggling the Windows Authentication on the site to negotiate, but same user/pass prompt.
appcmd set config /section:windowsAuthentication /-providers.[value='Negotiate']
Anyone know a solution for Chrome on OS X?
EDIT
OS X 10.6.8
Centrify for Mac will be used to authenticate to the (Windows 2008 R2 ActiveDirectory) network via CAC.
EDIT 2
There is a proxy setup, but it gets bypassed for local intranet sites, so I don't think it is playing a role.
Also tried using the --auth-server-whitelist command line switch, didn't work.
EDIT 3
SOLUTION
open 'Google Chrome.app' --args --auth-server-whitelist="*DOMAIN.TLD" --auth-negotiate-delegate-whitelist="*DOMAIN.TLD" --auth-schemes="digest,ntlm,negotiate"
Unfortunately Google Chrome for Mac has no way of specifying command line arguments on every load, so some sort of shell script will need to be made.
Running the following shell script at log in was the final solution to get around Chrome updates and extra doc icons.
#!/bin/bash
cd /Applications/Google\ Chrome.app/Contents/MacOS/
if [ -f 'Google Chrome.bin' ];
then
echo "Already Modified"
else
sudo chmod u+wr ./
sudo mv 'Google Chrome' 'Google Chrome.bin'
sudo echo "#!/bin/bash" > "Google Chrome"
sudo echo 'exec /Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome.bin --args --auth-server-whitelist="*DOMAIN.TLD" --auth-negotiate-delegate-whitelist="*DOMAIN.TLD" --auth-schemes="digest,ntlm,negotiate"' >> "Google Chrome"
sudo chmod a+x 'Google Chrome'
echo "NTLM Will now work in chrome"
fi
This isn't a bug at the moment. The Mac version of Chrome simply does not support/respect Kerberos policies ("Negotiate" Windows Authentication) unless the domain white-listed and the browser fired from the command line. See this link posted 10/31/2011:
http://code.google.com/p/chromium/issues/detail?id=102339
It looks like you might be able to permanently white-list a domain though:
http://www.google.com/support/forum/p/Chrome/thread?tid=592eb87350d9d528&hl=en
Since you have already tried the white-list switch, I looked closer and it is an OSX thing... 10.7 is necessary for the switch to work properly with Chrome. Your 10.6 version won't work without a third party tool like Centrify.
Not a happy answer, but the truth.
It seems we can do the following configuration in Terminal,
$ defaults write com.google.Chrome AuthServerWhitelist "*.example.com"
$ defaults write com.google.Chrome AuthNegotiateDelegateWhitelist "*.example.com"
$ defaults write com.google.Chrome AuthSchemes "digest,ntlm,negotiate"
defaults write com.google.Chrome AuthServerWhitelist '<your domain>' will permanently allow kerberos to a server or set of servers (*.mydomain.local).
What version of Chrome? This was an active bug, make sure you've got the latest version. It should work...
http://chromium.googlecode.com/issues/attachment?aid=-4050060571219819368&name=Prompt.png&token=NHQTVDWyO_jUXxWmvuzGnGer2sc%3A1325131426103&inline=1
http://code.google.com/p/chromium/issues/detail?id=19
Integrated Windows Auth (NTLM) on a Mac using Safari:
Update krb5.conf
$ sudo nano /etc/krb5.conf
[logging]
default = /var/log/krb5libs.log
kdc = /var/log/krb5kdc.log
admin_server = /var/log/kadmind.log
[libdefaults]
dns_lookup_realm = true
dns_lookup_kdc = true
ticket_lifetime = 24h
forwardable = yes
default_realm = MY.DOMAIN
udp_preference_limit = 1
[realms]
[domain_realm]
[appdefaults]
pam = {
debug = false
ticket_lifetime = 36000
renew_lifetime = 36000
forwardable = true
krb4_convert = false
}
Run kinit command
$ kinit -V myuser
myuser#MY.DOMAIN's password:
Placing tickets for 'myuser#MY.DOMAIN' in cache 'API:redacted'
Access website via Safari
Note: This used to work with chrome using the following commands but has recently stopped working - so now use Safari:
defaults write com.google.Chrome AuthServerWhitelist "*.MY.DOMAIN"
defaults write com.google.Chrome AuthNegotiateDelegateWhitelist "*.MY.DOMAIN"
defaults write com.google.Chrome AuthSchemes "digest,ntlm,negotiate"

How do you restart Samba on OSX 10.6.7?

How do you restart Samba on OSX 10.6.7? I've looked everywhere can't fine any docs.
Reason for asking is that on occasion Samba just hangs and I have to forcibly restart the mac to fix it. (restart command just hangs the mac)
On a terminal, sudo killall smbd will terminate all smbd instances.
They will be respawned on demand accoring to my tests (i.e. kill all smbd, then try to browse the services with smbclient -L hostname, and the daemons are restarted automagically).
You can check for smbd processes easily with ps uax | grep smbd
Edit: if you need to really assassinate blocked smbd processes, use killall -9 smbd (which is not recommended, see section on signals )

Resources