Trying to enable "web sharing" from terminal

 
Thread Tools Search this Thread
Operating Systems OS X (Apple) Trying to enable "web sharing" from terminal
# 1  
Old 06-22-2011
Trying to enable "web sharing" from terminal

I am using phproxy on my mac. I would like to be able to enable / disable web sharing from the command line, so I can turn it on only when I need it(remotely). I remember reading that the "screen sharing" can be set on/off in /Library/Preferences
I don't see any obvious preferences for "web sharing" Does anyone know a way to do this?
# 2  
Old 06-24-2011
man -k sharing
InternetSharing(8) - simple NAT/router configuration daemon
threads::shared(3pm) - Perl extension for sharing data structures between threads

man InternetSharing

man defaults


It appears the com.apple.nat.plist is not created until internet sharing is turned on, so you might want to turn it on through the GUI and examine the resulting plist file.

defaults read /Library/Preferences/SystemConfiguration/com.apple.nat

Note that the defaults command reads plist files, but fails if you specify the plist file extension ".plist"
Leave the file extension off when accessing a plist file with the defaults command.

Good luck. Smilie

There may be a simpler way, so examine the other SystemConfiguration/ plist files after enabling the internet sharing feature...
This User Gave Thanks to [MA]Flying_Meat For This Post:
# 3  
Old 06-26-2011
Thanks for your replies [MA]Flying Meat,
This is a bit more involved than I was hoping. My unix knowledge is still pretty basic. The more I read about it, the idea of running a phproxy on my home computer probably isn't the best solution for me.
# 4  
Old 07-28-2011
Tools

not sure about previous versions, but OSX Lion simply passes a name to apache when web sharing is enabled from system prefs to load the "web sharing" configs.

to start apache with web sharing enabled from terminal:
Code:
sudo /usr/sbin/httpd -k start -D WEBSHARING_ON

in httpd.conf you will find this block:
Code:
<IfDefine WEBSHARING_ON>
# Multi    -language error messages
#Include /private/etc/apache2/extra/httpd-multilang-errordoc.conf

# Fancy directory listings
Include /private/etc/apache2/extra/httpd-autoindex.conf

# User home directories
Include /private/etc/apache2/extra/httpd-userdir.conf

# Real-time info on requests and configuration
#Include /private/etc/apache2/extra/httpd-info.conf

# Virtual hosts
Include /private/etc/apache2/extra/httpd-vhosts.conf

# Local access to the Apache HTTP Server Manual
#Include /private/etc/apache2/extra/httpd-manual.conf

# Distributed authoring and versioning (WebDAV)
#Include /private/etc/apache2/extra/httpd-dav.conf

</IfDefine>

i've tested this and i'm pretty sure that's all there is to it.
Login or Register to Ask a Question

Previous Thread | Next Thread

8 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Bash script - Print an ascii file using specific font "Latin Modern Mono 12" "regular" "9"

Hello. System : opensuse leap 42.3 I have a bash script that build a text file. I would like the last command doing : print_cmd -o page-left=43 -o page-right=22 -o page-top=28 -o page-bottom=43 -o font=LatinModernMono12:regular:9 some_file.txt where : print_cmd ::= some printing... (1 Reply)
Discussion started by: jcdole
1 Replies

2. AIX

How to enable "TCP MD5 Signatures" and "https" on AIX?

I have searched many times but nothing found. Somebody help please :(:(:( (1 Reply)
Discussion started by: bobochacha29
1 Replies

3. OS X (Apple)

"Locate" Shows Files but Not "LS" in Terminal

OS-X 10.8.4 Using locate I get these results: 10:~ mize$ locate /Users/mize/*.sh /Users/mize/Zend/workspaces/DefaultWorkspace/SLM/vendor/ZF2/bin/check-cs.sh /Users/mize/copy_ascii_upload.sh /Users/mize/copy_ascii_upload_to_server.sh /Users/mize/copy_form_functions_php_to_jpl.sh... (7 Replies)
Discussion started by: Gary Mize
7 Replies

4. Shell Programming and Scripting

Checking running process status using "grep" on multiple servers in load sharing system.

Suppose i have 3 different servers say x,y and z. Im running some process say ABC and 40 instances for the same is being created. In load sharing suppose on server x, 20 instances are running server y, 10 instances are running server z, 10 instances are running. While checking the... (1 Reply)
Discussion started by: ankitknit
1 Replies

5. Shell Programming and Scripting

How to enable "banner" for a user in solaris?

Password: Using keyboard-interactive authentication. Do you agree with the banner terms (y/n)?: y (4 Replies)
Discussion started by: frintocf
4 Replies

6. Shell Programming and Scripting

awk command to replace ";" with "|" and ""|" at diferent places in line of file

Hi, I have line in input file as below: 3G_CENTRAL;INDONESIA_(M)_TELKOMSEL;SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL My expected output for line in the file must be : "1-Radon1-cMOC_deg"|"LDIndex"|"3G_CENTRAL|INDONESIA_(M)_TELKOMSEL"|LAST|"SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL" Can someone... (7 Replies)
Discussion started by: shis100
7 Replies

7. UNIX for Dummies Questions & Answers

Explain the line "mn_code=`env|grep "..mn"|awk -F"=" '{print $2}'`"

Hi Friends, Can any of you explain me about the below line of code? mn_code=`env|grep "..mn"|awk -F"=" '{print $2}'` Im not able to understand, what exactly it is doing :confused: Any help would be useful for me. Lokesha (4 Replies)
Discussion started by: Lokesha
4 Replies

8. Programming

what difference between "terminal" and "console"

1 . Thank you for reading the post first. 2 . what difference between "terminal" and "console" (1 Reply)
Discussion started by: chenhao_no1
1 Replies
Login or Register to Ask a Question