Skip to content
View in the app

A better way to browse. Learn more.

Thailand News and Discussion Forum | ASEANNOW

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Autoexec.bat

Featured Replies

Hi,

Im a total linux newbie.

I am experimenting something on Linux (CentOS 4.3 at the moment) this may evolve to a commercial application to me.

In the days of M$ DOS, if we add commands to the autoexec.bat file, those commands would run serially at startup. How to acheive this in Linux?

More specifically, what i want to do is Whenever any user other than root(and a handfull of other users) login VIA SSH, i want it to automatically run some command line stuff which the user has no way of omiting.

say for instance i want the user to use only applicationx during his SSH session.

now when he user connects via SSH, types in username and password, then "applicationx" automatically typed at the bash prompt and when the user is exits applicationx, "logout" command is issued.

There should be no way the user can access the bash prompt.

Now i have done some searching on the web, i figured its a steep learning curve, but i just need this basic functionality first.

Ok,

There's a few ways you could do that.

I'm not familiar with CentOS but it's based around RedHat I think?? So I'm assuming bash is your login shell ...

Create or edit a file called .bash_profile in your home directory.

Put any commands you want to execute at login there.

Here's an example

echo "Welcome, the time is "

date

If you want to do this system wide for all users edit /etc/profile.

Also check out the bash manual pages.

man bash

  • Author

hi Simmo,

Thanks a lot for the help,

it worked perfectly.

The file .bash_profile was already there. i just typed in the command i want and then logout.

its doing exactly what i want.

However there is a problem with this approach.

As soon as i type my password and enter, if i press Ctrl+C the .bash_profile script quits and i get to the bash prompt.

My main intention is to allow users use a linux text application via SSH, but in no way let them access the bash prompt. (security concerns and i dont want to reveal the user what OS am i using).

As soon as i type my password and enter, if i press Ctrl+C the .bash_profile script quits and i get to the bash prompt.

This should do the trick for that. Put it as the first command in .bash_profile.

trap 'echo "Control-C disabled."' 2

Or you might need to put it in /etc/profile or /etc/bash_profile if I remember redhat correctly.

  • Author
trap 'echo "Control-C disabled."' 2

i tried this on the bash... all it does is echos the text when ctrl+C is pressed, doesnt actually block the effect of the control-C

trap 'echo "Control-C disabled."' 2

i tried this on the bash... all it does is echos the text when ctrl+C is pressed, doesnt actually block the effect of the control-C

Simmo almost had it correct. For purposes of simplicity, simply try...

trap "" 2

This should disable the ability of a user to use Ctrl-C. Remember, this must/should be the first statement in the .bash_profile file.

  • Author

trap 'echo "Control-C disabled."' 2

i tried this on the bash... all it does is echos the text when ctrl+C is pressed, doesnt actually block the effect of the control-C

Simmo almost had it correct. For purposes of simplicity, simply try...

trap "" 2

This should disable the ability of a user to use Ctrl-C. Remember, this must/should be the first statement in the .bash_profile file.

Thanks a lot its working now.

Control-C isint working.

The application i am runing on linux is dosemu. So far i have tried this on on CentOS 4.3 on VMWare on Windows XP on my notebook with 2 concurent users and no problems... i think it should hold up much stronger on a proper box.

Any recomendations which distro should i go for? dont need all the bells and whistles, just the basic linux which supports SSH and will run dosemu the best.

DOSEMU ( http://www.dosemu.org/ ) is an emulator for DOS in linux, it seems pretty stable, just high on resources as in runing a simple dos application (which can run smoothly on a 368 DOS box even), hogs up 40% to 50% CPU power.

In case anyone is familiar with the emulator i have some questions...

Otherwise any other emulators for DOS out there i can play with? i just came accross Dosbox... will try it now...

The application i am runing on linux is dosemu. So far i have tried this on on CentOS 4.3 on VMWare on Windows XP on my notebook with 2 concurent users and no problems... i think it should hold up much stronger on a proper box.

Sounds like a lot of layers of emulation going on there. Is this a legacy app? .. Do you have access to the source code? It might be worth porting it to Linux if you're worried about the performance ...

  • Author

This wont be the final enviornment, for my application.

For the production enviornment(that is if i go ahead with this thing) would definately be a proper linux box dedicated only for this work.

I cant tell you the name of this application, all i can say is it is a propritery software for which i dont have the source. This application works under DOS. Even if you use the installer in windows, the application opens up in DOS.

I know the developers of this application(there is demand for a remotely hosted version), and at the moment they are too lazy to port it to linux, they dont even know what a linux screen looks like :-x

Getting the source from them is way out of the question.

  • Author

Another issue i am facing is displaying extended ascii characters.

If you are familiar with dosemu then perhaps you can help.

I have read the documentation and stuff.

the problem is when the dos application wants to show certain symbols(for text based graphics like lines etc) it shows latin charset.

anything over ascii 128 isint shown as extended ascii.

I have tried setting the charset as "ibm", but this makes it even worse.

Latin works fine for symbols below ascii 128.

oh and btw im connecting to the linux box over SSH using putty.

Create an account or sign in to comment

Recently Browsing 0

  • No registered users viewing this page.

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.