7

I want to configure lynx to always accept cookies, but without having to hack the OS level configuration in /etc/lynx.cfg.

How can I do this? Note: calling lynx with command line options is not an acceptable answer, but if you need to setup ENVIRONMENT variables, it's ok, I can put them in .bashrc.

Tom Newton
  • 71
  • 1
  • 7
sorin
  • 11,660
  • 20
  • 63
  • 73
  • 2
    What OS are you using (Linux, I assume)? Why would command line options not be a slution? You could always add an alias to lynx in your .bashrc that includes the options. – terdon Dec 12 '12 at 18:02

6 Answers6

5

As I said in my comment, the easiest way to do this (since according to its man page, lynx does not have a user configuration file) would be to add this line to your ~/.bashrc:

alias lynx='lynx -accept_all_cookies'

Then source ~/.bashrc or just open a new terminal and run lynx. Since it is now an alias, you will get the same behavior as if you had explicitly ran lynx -accept_all_cookies, but in a way that is completely transparent to the user.

Eric Leung
  • 103
  • 5
terdon
  • 52,568
  • 14
  • 124
  • 170
1

Step one - copy system lynx.cfg:

cp /etc/lynx.cfg ~/

Step two - modify your ~/lynx.cfg to your heart's content.

Step three - launch lynx with your custom cfg:

lynx -cfg=~/lynx.cfg <url>

It's possible older versions of lynx did not allow you to specify a config, but you can with my version.

lynx --version

Lynx Version 2.8.6rel.5 (09 May 2007)
libwww-FM 2.14, SSL-MM 1.4.1, OpenSSL 1.0.0-fips, ncurses 5.7.20090207(wide)
Built on linux-gnu Nov 23 2010 12:44:01

Copyrights held by the University of Kansas, CERN, and other contributors.
Distributed under the GNU General Public License.
See http://lynx.isc.org/ and the online help for more information.

See http://www.openssl.org/ for information about OpenSSL.
Kasapo
  • 111
  • 2
1

Lynx supports per-user configuration in .lynxrc:

The Lynx Options Menu may be accessed by pressing the “o” key. It allows you to change options at runtime, if you need to. Most changes are read from & saved to your .lynxrc file; those which are not are marked (!) in the form-based menu (as below). Many other options are stored in the lynx.cfg file.

Thorsten
  • 11
  • 1
0

I know this old and many have already provided valid answers but I thought this might help someone..

In case you're in rush and would like to add few configuration (CHARACTER_SET:UNICODE (UTF-8) in my case) here's a quick solution

lynx -cfg=<(echo 'CHARACTER_SET:UNICODE (UTF-8)') ...

or if you're in fish

lynx -cfg=(echo 'CHARACTER_SET:UNICODE (UTF-8)' | psub) ...

replacing 'CHARACTER_SET:UNICODE (UTF-8)' with your config

Naheel
  • 111
  • 2
0

You should be able to copy the system-wide lynx.cfg to your user's home directory and change your desired settings on a per-user level.

Rico
  • 74
  • 1
  • As per this answer http://superuser.com/a/909446/757 you must edit the global config to allow this – Andy May 12 '15 at 13:25
0

Okay this is old but I ended up here and there is no correct answer, I read the manual and found that you can add the following to your /etc/lynx.cfg to allow explicit options to be source from a dot file in your home dir.

INCLUDE:~/.lynx.cfg for PERSISTENT_COOKIES COOKIE_FILE

The following description take straight from the config file explains it better that I could

# Starting with Lynx 2.8.2, the INCLUDE facility is yet more powerful.  You can
# suppress all but specific settings that will be read from included files.
# This allows sysadmins to provide users the ability to customize lynx with
# options that normally do not affect security, such as COLOR, VIEWER, KEYMAP.
#
# The syntax is
#
#   INCLUDE:filename for <space-separated-list-of-allowed-settings>
#
squareborg
  • 2,425
  • 2
  • 19
  • 27